Switchable machine-learning models on common inference hardware for video coding
By implementing switchable machine-learning models on common inference hardware with unique parameters for each class of input data, the complexity and resource requirements of video coding are reduced, enhancing coding efficiency and throughput.
Patent Information
- Application Number
- PCT/US2024/017353
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-02-24
- Filing Date
- 2024-02-26
- Publication Date
- 2024-08-29
AI Technical Summary
Current machine-learning models for video coding are complex and resource-intensive, making them difficult to deploy widely due to high complexity requirements, especially on decoder hardware, which hampers coding efficiency and throughput.
The implementation of switchable machine-learning models on common inference hardware, where each class of input data is associated with a unique set of parameters, allowing for lightweight inference tasks to be performed on the same hardware architecture, breaking down inference tasks into smaller tasks across multiple classes of data.
This approach achieves high throughput with a small hardware footprint, improving coding efficiency and reducing computational complexity, enabling efficient video coding and decoding processes.
Smart Images

Figure US2024017353_29082024_PF_FP_ABST
Abstract
Description
SWITCHABLE MACHINE-LEARNING MODELS ON COMMON INFERENCEHARDWARE FOR VIDEO CODINGBACKGROUND
[0001] Digital video streams may represent video using a sequence of frames or still images. Digital video can be used for various applications, including, for example, video conferencing, high-definition video entertainment, video advertisements, or sharing of usergenerated videos. A digital video stream can contain a large amount of data and consume a significant amount of computing or communication resources of a computing device for processing, transmission, or storage of the video data. Various approaches have been proposed to reduce the amount of data in video streams, including compression and other encoding techniques. Machine-learning models have been incorporated into these approaches.SUMMARY
[0002] One aspect of the disclosed implementations is a method for use in coding image data. The method includes determining a class of input data for inference hardware of a coder, determining, using the class, parameters for a machine-learning model comprising the inference hardware, and generating output data from the machine-learning model. The parameters comprise one set of multiple sets of unique parameters, each set of the multiple sets is associated with a respective class of input data, and each set of the multiple sets defines a respective machine-learning model comprising the inference hardware.
[0003] Another aspect of the disclosed implementations is an apparatus for use in coding image data. The apparatus includes a coder with inference hardware and storage storing multiple sets of unique parameters. Each set of the multiple sets is associated with a respective class of input data, and each set of the multiple sets defines a respective machinelearning model comprising the inference hardware. The coder performs a method including determining a class of input data for the inference hardware, determining, using the class, parameters for a machine-learning model comprising the inference hardware, wherein the parameters comprise one set of the multiple sets of unique parameters, and generating output data from the machine-learning model.
[0004] In some implementations, the parameters comprise weights, biases, or both, for the machine-learning model.
[0005] In some implementations, the class is determined by decoding, from a bitstream, a class index, and identifying the class using the class index.
[0006] In some implementations, the class is determined by determining available classes of input data using encoding parameters of the input data, wherein the available classes comprise a proper subset of all classes of input data, and identifying the class from the available classes using a class index.
[0007] In some implementations, the class is determined by determining a class index from encoding parameters of the input data, and identifying the class using the class index.
[0008] In either of these implementations, the encoding parameters can be a prediction type of the input data (e.g., whether a frame is an inter-frame or an intra-only frame), a quality value of the encoding of the input data (such as a quantization parameter value), and whether the input data was encoded using super-resolution (or not). When the input data was encoded using super-resolution, the down- and up-sampling ratio may be used as an encoding parameter.
[0009] In some implementations, parameters for the machine-learning model are determined by identifying the parameters from a storage storing the multiple sets of unique parameters. Each set of the multiple sets is identified by a respective class index.
[0010] The method and apparatus can be used with an encoder that includes the inference hardware, a decoder that includes the inference hardware, or both. The image data can be color data of at least a portion of a video frame.
[0011] In some implementations, the inference hardware is all or a portion of an in-loop restoration stage of an encoder, a decoder, or both the encoder and decoder may have duplicates of the inference hardware.
[0012] In some implementations, the determined machine-learning model is a convolution neural network (CNN) and / or each of the multiple machine-learning models is a CNN.
[0013] These and other aspects of the present disclosure are disclosed in the following detailed description of the embodiments, the appended claims, and the accompanying figures.BRIEF DESCRIPTION OF THE DRAWINGS
[0014] The description herein refers to the accompanying drawings, wherein like reference numerals refer to like parts throughout the several views.
[0015] FIG. l is a schematic of a video encoding and decoding system.
[0016] FIG. 2 is a block diagram of an example of a computing device that can implement a transmitting station or a receiving station.
[0017] FIG. 3 is a diagram of a video stream to be encoded and subsequently decoded.
[0018] FIG. 4 is a block diagram of an encoder according to implementations of this disclosure.
[0019] FIG. 5 is a block diagram of a decoder according to implementations of this disclosure.
[0020] FIG. 6 is a flow chart diagram of a method for use in a coder incorporating switchable machine-learning (ML) models on common inference hardware.
[0021] FIG. 7 is a block diagram of common inference hardware for a coder used to explain the method of FIG. 6.
[0022] FIG. 8 is a diagram of selecting a class index for the common inference hardware according to an example of the teachings herein.
[0023] FIG. 9 is a diagram of training the classifier according to FIG. 8.
[0024] FIG. 10 is a diagram of a network architecture that can be used to implement the common inference hardware herein.
[0025] FIGS. 11 A and 1 IB are diagrams of a residue block architecture that can be used in the network architecture of FIG. 10.DETAILED DESCRIPTION
[0026] Encoding techniques may be designed to maximize coding efficiency. Coding efficiency can mean encoding a video at the lowest possible bit rate while minimizing distortion (e.g., while maintaining a certain level of video quality). Coding efficiency is typically measured in terms of both rate and distortion. Rate refers to the number of bits required for encoding (such as encoding a block, a frame, etc.). Distortion measures the quality loss between, for example, a source video block and a reconstructed version of the source video block. For example, the distortion may be calculated as a mean-square error between pixel values of the source block and those of the reconstructed block. By performing a rate-distortion optimization process, a video codec optimizes the amount of distortionagainst the rate required to encode the video. A decoder may process the encoded data to reconstruct the video data, including processing a resulting degraded frame to result in a reconstructed frame with an improved appearance for viewing.
[0027] Machine-learning (ML) models may be used in video compression and reconstruction. For example, modern video codecs define and use many tools and configurations (e.g., parameters) to improve coding efficiency and the reconstruction of video frames. A video encoder can use a mode decision to examine (e.g., test, evaluate, select, etc.) at least some of the valid combinations of parameters to select a combination that results in a relatively low rate-distortion value. Machine learning may be used to determine these discrete mode decisions (e.g., at an encoder), such as an intra-prediction mode decision, a partition decision, a transform type decision, etc., though inferencing. A video decoder (or a reconstruction path of an encoder) may use a ML model to reconstruct pixel values.
[0028] Complexity requirements for inference, particularly at the throughput desired for video, hampers the widespread deployment of ML models within a codec (e.g., coders including an encoder and decoder). Such complexity may require a heavy-weight ML model implementation, particularly on the decoder side. A heavy-weight ML model implementation refers to the use of multiple custom ML models as inference engines for the particular use case. Implementations of the teachings herein describe performing an inference task as smaller tasks over multiple classes of data (also referred to as patterns of data). For each class of data, only a small lightweight inference task may be performed and conducted readily on hardware at a desired throughput level. To do so, the same lightweight hardware architecture performs the inference task for each class, even though the parameters (e.g., weights and biases, as applicable) of the ML model may be different for each class.
[0029] ML models that can be used on common inference hardware (e.g., common inference architecture) are described herein. The ML models are described herein first with reference to a block-based codec in which the teachings herein may be incorporated. Although a block-based codec is described as an example, other codecs may be used with the present teachings, including without limitation a feature-based codec.
[0030] FIG. 1 is a schematic of a video encoding and decoding system 100. A transmitting station 102 can be, for example, a computer having an internal configuration of hardware, such as that described with respect to FIG. 2. However, other suitable implementations of the transmitting station 102 are possible. For example, the processing of the transmitting station 102 can be distributed among multiple devices.
[0031] A network 104 can connect the transmitting station 102 and a receiving station 106 for encoding and decoding of the video stream. Specifically, the video stream can be encoded in the transmitting station 102, and the encoded video stream can be decoded in the receiving station 106. The network 104 can be, for example, the Internet. The network 104 can also be a local area network (LAN), wide area network (WAN), virtual private network (VPN), cellular telephone network, or any other means of transferring the video stream from the transmitting station 102 to, in this example, the receiving station 106.
[0032] In one example, the receiving station 106 can be a computer having an internal configuration of hardware, such as that described with respect to FIG. 2. However, other suitable implementations of the receiving station 106 are possible. For example, the processing of the receiving station 106 can be distributed among multiple devices.
[0033] Other implementations of the video encoding and decoding system 100 are possible. For example, an implementation can omit the network 104. In another implementation, a video stream can be encoded and then stored for transmission at a later time to the receiving station 106 or any other device having memory. In one implementation, the receiving station 106 receives (e.g., via the network 104, a computer bus, and / or some communication pathway) the encoded video stream and stores the video stream for later decoding. In an example implementation, a real-time transport protocol (RTP) is used for transmission of the encoded video over the network 104. In another implementation, a transport protocol other than RTP, e.g., a Hypertext Transfer Protocol (HTTP)-based video streaming protocol, may be used.
[0034] When used in a video conferencing system, for example, the transmitting station 102 and / or the receiving station 106 may include the ability to both encode and decode a video stream as described below. For example, the receiving station 106 could be a video conference participant who receives an encoded video bitstream from a video conference server (e.g., the transmitting station 102) to decode and view and further encodes and transmits its own video bitstream to the video conference server for decoding and viewing by other participants.
[0035] FIG. 2 is a block diagram of an example of a computing device 200 that can implement a transmitting station or a receiving station. For example, the computing device 200 can implement one or both of the transmitting station 102 and the receiving station 106 of FIG. 1. The computing device 200 can be in the form of a computing system including multiple computing devices, or in the form of a single computing device, for example, amobile phone, a tablet computer, a laptop computer, a notebook computer, a desktop computer, and the like.
[0036] A CPU 202 in the computing device 200 can be a central processing unit. Alternatively, the CPU 202 can be any other type of device, or multiple devices, now-existing or hereafter developed, capable of manipulating or processing information. Although the disclosed implementations can be practiced with a single processor as shown (e.g., the CPU 202), advantages in speed and efficiency can be achieved by using more than one processor.
[0037] In an implementation, a memory 204 in the computing device 200 can be a readonly memory (ROM) device or a random-access memory (RAM) device. Any other suitable type of storage device can be used as the memory 204. The memory 204 can include code and data 206 that is accessed by the CPU 202 using a bus 212. The memory 204 can further include an operating system 208 and application programs 210, the application programs 210 including at least one program that permits the CPU 202 to perform the methods described herein. For example, the application programs 210 can include applications 1 through N, which further include a video coding application that performs the methods described herein. The computing device 200 can also include a secondary storage 214, which can, for example, be a memory card used with a computing device 200 that is mobile. Because the video communication sessions may contain a significant amount of information, they can be stored in whole or in part in the secondary storage 214 and loaded into the memory 204 as needed for processing.
[0038] The computing device 200 can also include one or more output devices, such as a display 218. The display 218 may be, in one example, a touch-sensitive display that combines a display with a touch-sensitive element that is operable to sense touch inputs. The display 218 can be coupled to the CPU 202 via the bus 212. Other output devices that permit a user to program or otherwise use the computing device 200 can be provided in addition to or as an alternative to the display 218. When the output device is or includes a display, the display can be implemented in various ways, including as a liquid crystal display (LCD); a cathode-ray tube (CRT) display; or a light-emitting diode (LED) display, such as an organic LED (OLED) display.
[0039] The computing device 200 can also include or be in communication with an image-sensing device 220, for example, a camera, or any other image-sensing device, now existing or hereafter developed, that can sense an image, such as the image of a user operating the computing device 200. The image-sensing device 220 can be positioned suchthat it is directed toward the user operating the computing device 200. In an example, the position and optical axis of the image-sensing device 220 can be configured such that the field of vision includes an area that is directly adjacent to the display 218 and from which the display 218 is visible.
[0040] The computing device 200 can also include or be in communication with a soundsensing device 222, for example, a microphone, or any other sound-sensing device, now existing or hereafter developed, that can sense sounds near the computing device 200. The sound-sensing device 222 can be positioned such that it is directed toward the user operating the computing device 200 and can be configured to receive sounds, for example, speech or other utterances, made by the user while the user operates the computing device 200.
[0041] Although FIG. 2 depicts the CPU 202 and the memory 204 of the computing device 200 as being integrated into a single unit, other configurations can be utilized. The operations of the CPU 202 can be distributed across multiple machines (each machine having one or more processors) that can be coupled directly or across a local area or other network. The memory 204 can be distributed across multiple machines, such as a network-based memory or memory in multiple machines performing the operations of the computing device 200. Although depicted here as a single bus, the bus 212 of the computing device 200 can be composed of multiple buses. Further, the secondary storage 214 can be directly coupled to the other components of the computing device 200 or can be accessed via a network and can comprise a single integrated unit, such as a memory card, or multiple units, such as multiple memory cards. The computing device 200 can thus be implemented in a wide variety of configurations.
[0042] FIG. 3 is a diagram of an example of a video stream 300 to be encoded and subsequently decoded. The video stream 300 includes a video sequence 302. At the next level, the video sequence 302 includes a number of adjacent frames 304. While three frames are depicted as the adjacent frames 304, the video sequence 302 can include any number of adjacent frames 304. The adjacent frames 304 can then be further subdivided into individual frames, for example, a frame 306. At the next level, the frame 306 can be divided into a series of segments 308 or planes. The segments 308 can be subsets of frames that permit parallel processing, for example. The segments 308 can also be subsets of frames that can separate the video data into separate colors. For example, the frame 306 of color video data can include a luminance plane and two chrominance planes. The segments 308 may be sampled at different resolutions.
[0043] Whether the frame 306 is divided into the segments 308 or not, the frame 306 may be further subdivided into blocks 310, which can contain data corresponding to, for example, 16x 16 pixels in the frame 306. The blocks 310 can also be arranged to include data from one or more segments 308 of pixel data. The blocks 310 can also be of any other suitable size, such as 4x4 pixels, 8x8 pixels, 16x8 pixels, 8x 16 pixels, 16x 16 pixels, or larger.
[0044] FIG. 4 is a block diagram of an encoder 400 in accordance with implementations of this disclosure. The encoder 400 can be implemented, as described above, in the transmitting station 102, such as by providing a computer software program stored in memory, for example, the memory 204. The computer software program can include machine instructions that, when executed by a processor, such as the CPU 202, cause the transmitting station 102 to encode video data in manners described herein. The encoder 400 can also be implemented as specialized hardware included in, for example, the transmitting station 102. The encoder 400 has the following stages to perform the various functions in a forward path (shown by the solid connection lines) to produce an encoded or compressed bitstream 420 using the video stream 300 as input: an intra / inter-prediction stage 402, a transform stage 404, a quantization stage 406, and an entropy encoding stage 408. The encoder 400 may also include a reconstruction path (shown by the dotted connection lines) to reconstruct a frame for encoding of future blocks. In FIG. 4, the encoder 400 has the following stages to perform the various functions in the reconstruction path: a dequantization stage 410, an inverse transform stage 412, a reconstruction stage 414, and a loop filtering stage 416. Other structural variations of the encoder 400 can be used to encode the video stream 300.
[0045] When the video stream 300 is presented for encoding, the frame 306 can be processed in units of blocks. At the intra / inter-prediction stage 402, a block can be encoded using intra-frame prediction (also called intra-prediction) or inter-frame prediction (also called inter-prediction), or a combination of both. In any case, a prediction block can be formed. In the case of intra-prediction, all or part of a prediction block may be formed from samples in the current frame that have been previously encoded and reconstructed. In the case of inter-prediction, all or part of a prediction block may be formed from samples in one or more previously constructed reference frames determined using motion vectors.
[0046] Next, still referring to FIG. 4, the prediction block can be subtracted from the current block at the intra / inter-prediction stage 402 to produce a residual block (also called a residual). The transform stage 404 transforms the residual into transform coefficients in, for example, the frequency domain using block-based transforms. Such block-based transforms(i.e., transform types) include, for example, the Discrete Cosine Transform (DCT) and the Asymmetric Discrete Sine Transform (ADST). Other block-based transforms are possible. Further, combinations of different transforms may be applied to a single residual. In one example of the application of a transform, the DCT transforms the residual block into the frequency domain where the transform coefficient values are based on spatial frequency. The lowest frequency (DC) coefficient is at the top-left of the matrix, and the highest frequency coefficient is at the bottom-right of the matrix. It is worth noting that the size of a prediction block, and hence the resulting residual block, may be different from the size of the transform block. For example, the prediction block may be split into smaller blocks to which separate transforms are applied.
[0047] The quantization stage 406 converts the transform coefficients into discrete quantum values, which are referred to as quantized transform coefficients, using a quantizer value or a quantization level. For example, the transform coefficients may be divided by the quantizer value and truncated. The quantized transform coefficients are then entropy encoded by the entropy encoding stage 408. Entropy coding may be performed using any number of techniques, including token and binary trees. The entropy-encoded coefficients, together with other information used to decode the block (which may include, for example, the type of prediction used, transform type, motion vectors, and quantizer value), are then output to the compressed bitstream 420. The information to decode the block may be entropy coded into block, frame, slice, and / or section headers within the compressed bitstream 420. The compressed bitstream 420 can also be referred to as an encoded video stream or encoded video bitstream; these terms will be used interchangeably herein.
[0048] The reconstruction path in FIG. 4 (shown by the dotted connection lines) can be used to ensure that both the encoder 400 and a decoder 500 (described below) use the same reference frames and blocks to decode the compressed bitstream 420. The reconstruction path performs similar functions to those functions that take place during the decoding process and that are discussed in more detail below, including dequantizing the quantized transform coefficients at the dequantization stage 410 and inverse transforming the dequantized transform coefficients at the inverse transform stage 412 to produce a derivative residual block (also called a derivative residual). At the reconstruction stage 414, the prediction block that was predicted at the intra / inter-prediction stage 402 can be added to the derivative residual to create a reconstructed block. The loop filtering stage 416 can be applied to the reconstructed block to reduce distortion, such as blocking artifacts.
[0049] Other variations of the encoder 400 can be used to encode the compressed bitstream 420. For example, a non-transform based encoder 400 can quantize the residual signal directly without the transform stage 404 for certain blocks or frames. In another implementation, an encoder 400 can have the quantization stage 406 and the dequantization stage 410 combined into a single stage.
[0050] FIG. 5 is a block diagram of a decoder 500 in accordance with implementations of this disclosure. The decoder 500 can be implemented in the receiving station 106, for example, by providing a computer software program stored in the memory 204. The computer software program can include machine instructions that, when executed by a processor, such as the CPU 202, cause the receiving station 106 to decode video data in the manners described below. The decoder 500 can also be implemented in hardware included in, for example, the transmitting station 102 or the receiving station 106.
[0051] The decoder 500, similar to the reconstruction path of the encoder 400 discussed above, includes in one example the following stages to perform various functions to produce an output video stream 516 from the compressed bitstream 420: an entropy decoding stage 502, a dequantization stage 504, an inverse transform stage 506, an intra / inter-prediction stage 508, a reconstruction stage 510, a loop filtering stage 512, and a post filtering stage 514. Other structural variations of the decoder 500 can be used to decode the compressed bitstream 420.
[0052] When the compressed bitstream 420 is presented for decoding, the data elements within the compressed bitstream 420 can be decoded by the entropy decoding stage 502 to produce a set of quantized transform coefficients. The dequantization stage 504 dequantizes the quantized transform coefficients (e.g., by multiplying the quantized transform coefficients by the quantizer value), and the inverse transform stage 506 inverse transforms the dequantized transform coefficients using the selected transform type to produce a derivative residual that can be identical to that created by the inverse transform stage 412 in the encoder 400. Using header information decoded from the compressed bitstream 420, the decoder 500 can use the intra / inter-prediction stage 508 to create the same prediction block as was created in the encoder 400, for example, at the intra / inter-prediction stage 402. At the reconstruction stage 510, the prediction block can be added to the derivative residual to create a reconstructed block. The loop filtering stage 512 can be applied to the reconstructed block to reduce blocking artifacts. Other filtering can be applied to the reconstructed block. In an example, the post filtering stage 514 is applied to the reconstructed block to reduce blockingdistortion, and the result is output as an output video stream 516. The output video stream 516 can also be referred to as a decoded video stream; these terms will be used interchangeably herein.
[0053] Other variations of the decoder 500 can be used to decode the compressed bitstream 420. For example, the decoder 500 can produce the output video stream 516 without the post filtering stage 514. In some implementations of the decoder 500, the post filtering stage 514 is applied after the loop filtering stage 512. The loop filtering stage 512 can include an optional deblocking filtering stage.
[0054] At least some components of an encoder or decoder of a codec, such as the encoder 400 or decoder 500, may be implemented using trained, switchable ML models on common inference hardware. FIG. 6 is a flow chart diagram of a method 600 for use in a coder incorporating switchable ML models on common inference hardware, and FIG. 7 is a block diagram of the common inference hardware 700 for a decoder used to explain the method 600 of FIG. 6.
[0055] In general, the method 600 and the common inference hardware 700 take advantage of breaking up an inference task into smaller tasks over multiple classes or patterns of data. For each class of data, a small lightweight inference task is sufficient and can be conducted readily on hardware at the desired throughput level. For each class, the inference task can be conducted on the same lightweight hardware architecture, even though the weights and biases, where applicable, may be different for each class. In this way, high throughout may be achieved with a small hardware footprint as compared to conventional techniques.
[0056] Referring first to FIG. 6, the method 600 includes determining the inference hardware needed for the input data at operation 602. More particularly, the input data may be used at operation 602 for determining the inference hardware. The input data may be associated with a stage of the decoding or encoding process. Hence, determining the inference hardware needed for the input the input data may include determining the inference hardware, if any, associated with a particular stage of the process. For example, the input data may comprise reconstructed block or frame data requiring in-loop or post-processing filtering, such as at the loop filtering stage 512 or the post filtering stage 514 of the decoder 500 or the loop filtering stage 416 of the encoder 400. Although the teachings herein are more useful as part of a (e.g., hardware) decoder, they may be used with an encoder. For example, the input data may comprise color data for the inference task of partitioning or theinference task of selecting a prediction mode, such as at the intra / inter prediction stage 402 of the encoder 400, residual data for the inference task of selecting a transform mode, such as at the transform stage 404 of the encoder 400, etc.
[0057] As can be seen with reference to FIG. 7, the input data (also referred to as video data input) is provided to an inference engine 702 for generating output data (also referred to as video data output). The inference engine 702 may be referred to as a common inference engine because the inference engine 702 has a common architecture (i.e., the inference hardware determined at operation 602) for all classes of the input data as described below.
[0058] The hardware forming the inference engine 702 can include a neural network, such as a convolution neural network (CNN) and / or a fully connected neural network. The inference engine 702 can include any trained machine-learning model — non-limiting examples are described below.
[0059] At a high level, and without loss of generality, the machine-learning model, such as a deep-learning model, includes two main portions: a feature-extraction portion and a classification portion. The feature-extraction portion detects features of the model. The classification portion attempts to classify the detected features into a desired response. Each of the portions can include one or more layers and / or one or more operations. The term “classification” is used herein to refer to the one or more of the layers that outputs one or more values from the model. The output may be a discrete value, such as a class or a category. The output may be a continuous value, e.g., a rate value, a distortion value, a ratedistortion (RD) cost value. As such, the classification portion may be appropriately termed a regression portion.
[0060] As mentioned above, a CNN is an example of a machine-learning model. In a CNN, the feature-extraction portion often includes a set of convolutional operations. The convolution operations may be a series of filters that are used to filter input data based on a filter (typically a square of size k, without loss of generality). For example, and in the context of machine vision, these filters can be used to find features in the input data. The features can include, for example, edges, corners, endpoints, and so on. As the number of stacked convolutional operations (e.g., layers) increases, later convolutional operations can find higher-level features. It is noted that the term “features” is used in two different contexts within this disclosure. First, “features” can be extracted, from an input image or block, by the feature-extraction portion of a CNN. Second, “features” can be calculated (e.g., derived) froman input block and used as inputs to a machine-learning model. Context makes clear which use of the term “features” is intended.
[0061] In a CNN, the classification (e.g., regression) portion can be a set of fully connected layers. The fully connected layers can be thought of as looking at all the input features to generate a high-level classifier. Several stages (e.g., a series) of high-level classifiers eventually generate the desired regression output.
[0062] As mentioned, a CNN may be composed of multiple convolutional operations (e.g., the feature-extraction portion) followed by multiple fully connected layers. The number of operations of each type and their respective sizes may be determined during the training phase of machine learning. As a person skilled in the art recognizes, additional layers and / or operations can be included in each portion. For example, combinations of Pooling, MaxPooling, Dropout, Activation, Normalization, BatchNormalization, and other operations can be grouped with convolution operations (i.e., in the feature-extraction portion) and / or the fully connected operation (i.e., in the classification portion). The fully connected layers may be referred to as Dense operations. A convolution operation can use a SeparableConvolution2D or Convolution2D operation.
[0063] As used in this disclosure, a convolution layer can be a group of operations starting with a Convolution2D or SeparableConvolution2D operation followed by zero or more operations (e.g., Pooling, Dropout, Activation, Normalization, BatchNormalization, other operations, or a combination thereof), until another convolution layer, a Dense operation, or the output of the CNN is reached. Similarly, a Dense layer can be a group of operations or layers starting with a Dense operation (i.e., a fully connected layer) followed by zero or more operations (e.g., Pooling, Dropout, Activation, Normalization, BatchNormalization, other operations, or a combination thereof) until another convolution layer, another Dense layer, or the output of the network is reached. The boundary between feature extraction based on convolutional networks and a feature classification using Dense operations can be marked by a Flatten operation, which flattens the multidimensional matrix from the feature extraction into a vector.
[0064] Each of the fully connected operations is a linear operation in which every input is connected to every output by a weight. As such, a fully connected layer with N number of inputs and M outputs can have a total of N*M weights. A Dense operation may be followed by a non-linear activation function to generate an output of that layer.
[0065] The ML model may be trained using the vast amount of training data that is available from an encoder and / or decoder performing standard coding techniques, such as those described with respect to FIGS. 4 and 5. More specifically, the training data can be used during the learning phase of machine learning to derive (e.g., learn, infer, etc.) the machine-learning model that is (e.g., defines, constitutes, etc.) a mapping from the input data to output data. Desirably, the training methodology automatically generates suitable classes and corresponding models that use the same architecture to enable running on common hardware. However, various training methodologies may be used to train the models (e.g., selecting the best set of parameters for any particular set of input data).
[0066] As mentioned initially, the inference task can be conducted using the same inference hardware (i.e., the same lightweight hardware architecture) using respective parameters (weights and optionally biases) for each class. Accordingly, after determining the inference hardware at operation 602, the method 600 determines a class of the input data at operation 604. The bitstream can indicate the class to use for inference over a suitable portion of the input data, which could be a block, tile, a frame, or even a group of frames.
[0067] The class may be determined by a class index as shown in FIG. 7. In FIG. 7, there are N classes of inference networks, each corresponding to a respective set of parameters (e.g., weights and optionally biases) stored in a storage 704, which may comprise a non- transitory storage medium such as the storage 214 of FIG. 2.
[0068] In some implementations of a decoder, the class index determined at operation 604 is completely specified in the bitstream (e.g., the class index is decoded from the bitstream). In other implementations, the class index is completely derived from other information already in the bitstream, for example, quantization value or quantization parameter (qp), encoding resolution, prediction mode, etc. In an implementation described below where the inference hardware (e.g., the inference engine 702) is used for frame restoration in an example of the teachings herein, each supported coded resolution can have multiple classes corresponding to different qp-ranges, and therefore the union of all qp-based buckets for all supported resolutions correspond to N. In still other implementations, the class index may be derived partly from other information already in the bitstream and partly from symbols in the bitstream. For example, values for one or more other parameters from the bitstream may be associated with a set of available classes, and the index within that set may be decoded from the bitstream. In frame restoration, for example, combinations of qp andcoding resolution can have respective sets of available classes, and the index within a set identifying the class may be signaled in the bitstream.
[0069] Knowing the class index, the method 600 can determine the parameters for the class at operation 606. That is, the coder can download the parameters corresponding to the given class from storage 704 into the inference hardware, forming the inference engine 702 to conduct the inference task. That is, the output data is generated at operation 608 using the inference engine 702 with the video data input and the parameters comprising weights and / or biases for the class (i.e., class 1, class 2, ... class N) from storage 704. Because the coder (in this example a decoder) implements the inference engine 702 (e.g., a switchable ML model) using common inference hardware, the coder can maintain a (e.g., computationally) light silicon footprint.
[0070] At an encoder, the method 600 may be performed similarly to the decoder, e.g., in a restoration path. That is, the inference hardware is determined at operation 602 based on the coding function to be performed. Thereafter, the class of input data is determined at operation 604. In some implementations, the class may be determined at a frame level. Any technique may be used by the encoder to determine the class index and hence the class. For example, given the available classes with corresponding parameters (e.g., weights and biases), an encoder may try all the available models and signal the index for the best one in the bitstream. Alternatively, an encoder-side ML model may be used to decide the index of the class to use for the input data as shown by the example of FIG. 8.
[0071] More particularly, FIG. 8 is a diagram of selecting a class index for the common inference hardware according to an example of the teachings herein. FIG. 8 uses a classifier 802 at an encoder, such as the encoder 400, to select a class for restoration of a degraded frame. For example, the classifier 802 may be incorporated at the loop filtering stage 416. The classifier 802 may generate a class for use at the loop filtering stage of a decoder, such as at the loop filtering stage 512 of the decoder 500. Alternatively, or additionally, the classifier 802 may be used as post-processing stage in an encoder to generate a class for use by a postprocessing stage of a decoder, such as the post filtering stage 514 of the decoder 500.
[0072] Input into the classifier 802 can vary dependent upon the function of the inference hardware (e.g., what output is being sought). In this example, the input comprises a degraded frame 804 and desired output data — the original frame 806. That is, an object of this classification is to obtain a class whose weights and biases are such that the degraded frame 804, after reconstruction at a decoder, is restored to a frame that is close to the appearance ofthe original frame 806. The output of the classifier 802 may comprise an array 808 of values corresponding to how well each class performs the restoration. A function applied over the values, such as argmax, may be used to select the class. In this example, the value associated with the shaded value identifies the class index.
[0073] FIG. 9 is a diagram of a non-limiting example of training the classifier 802 according to FIG. 8. In FIG. 9, training data in the form of respective pairs of degraded frames 904 and original frames 906 are used for training the classifier 802. For each pair, the degraded frame 904 is processed using respective parameters (e.g., weights and biases) of multiple classes (e.g., class 1 through class N) with the common hardware to produce respective restored frames 908 1 through 908 N. The classifier 802 uses the degraded frame 904 and the corresponding original frame 906 to produce an array of multipliers for the restored frames 908 1 through 901 N such that the sum of the (e.g., color) values of the restored frames result in a final restored frame 910 that corresponds to a restored frame determined using, for example, conventional techniques. By repeating this process for multiple pairs of degraded frames 904 and their corresponding original frames, the weights and biases for each class, and the bounds of each class, may be updated and refined. That is, the ML model learns (e.g., trains, builds, derives, etc.) a mapping (i.e., a function) from the inputs to the outputs for respective classes.
[0074] Whatever technique is used, after an encoder has determined the class at operation 604, the parameters for the class are determined at operation 606 (e.g., based on the class index), and output data is generated using the inference hardware and the parameters as an inference engine at operation 608.
[0075] As mentioned, the techniques described herein regarding the switchable ML models may be used with various stages of a decoder and / or an encoder. One particularly beneficial use is with the in-loop filtering and restoration process of video frames after conventional decoding, whether the video frames are encoded using a same (e.g., an unchanged, original) resolution mode or a super-resolution mode. In either case, the restoration pipeline may comprise a coded-resolution restoration tools set, designed for use at the coded resolution, followed by optional upsampling that converts the image or frame to an output resolution and an output-resolution restoration tools set, designed for use at the output resolution. Note that the coded resolution may be equal to the output resolution in the absence of a super-resolution mode. The output resolution is most often the source resolution before downsampling in super-resolution mode. In some implementations, the coded-resolutionrestoration tools set includes a deblocking filter followed by a Constrained Directional Enhancement Filter (CDEF). In some implementations, the output-resolution restoration tools set includes loop restoration tools, for example a separable Wiener filter and a combination of up to two guided filters. A super-resolution index may be decoded from the bitstream to indicate the downsampling resolution and the upsampling resolution.
[0076] According to an implementation of the teachings herein, the output-resolution restoration tools set may replace or supplement the switchable ML models described above. In an example, multiple models are determined for each down and upsampling ratio (including the same-resolution mode where the ratio is 1 :1). The models within each group may be trained for different qualities of encoding, such as by qp described previously. The models within each group may be trained based on whether the frame is encoded using interprediction or whether the frame is encoded as an Intra-only frame (i.e., no blocks of the frame are encoded using inter-prediction). Accordingly, a decoder may determine the class of the input data (e.g., at 604) by express signaling, or may determine the class of the input data (e.g., at 604) from other information determined from the bitstream (e.g., from the frame header), such as the down and upsampling ratio (or a corresponding super-resolution index), the qp value, and / or the frame encoding as inter-prediction or intra-only. In some implementations, one or more of these values may be used to define members of classes, and the class index is expressly signaled. For example, for combinations of a super-resolution index and the inter / intra distinction described, an additional symbol identifying the class index and hence the parameters for the class, i.e., the ML model for the inference, may be included.
[0077] For decoding, a decoder may determine whether a frame is to be restored using conventional loop restoration tools or the switchable ML models described herein by decoding a flag or other signal encoded into the bitstream (e.g., into the frame header). In some implementations, the switchable ML models are the only tools used, so no additional flag or other signal is used.
[0078] As mentioned, the ML models may be implemented using a common inference (also referred to as inference hardware or inference hardware herein). In some implementations, the individual ML models may be designed as subsets of a single, largest model, thereby allowing a single hardware architecture to represent all ML models. An example of this is next described using CNN models as the ML models.
[0079] FIG. 10 is a diagram of a network architecture 1000 that can be used to implement the common inference hardware herein. The network architecture 1000 predicts a residual image D from input image X. For example, the input image X can be the reconstructed image output from the loop filtering stage 416 or loop filtering stage 512 after upsampling, if any. The desired output image is then obtained as Y = X + D. A single channel X is input to the network architecture 1000, and a single channel D is output. As shown in FIG. 10, the network architecture 1000 includes an analysis CNN layer 1010 that decomposes the input channel A into co channels, optionally at a lower resolution determined by a stride 5 of the CNN, n residue blocks where the zth residue block (with z = 0, 1, . . . , zz-l) has a input channels and +I output channels, and a final synthesis CNN layer that combines cnchannels into a single output channel D at the original resolution of channel X. In the case that the stride 5 is greater than 1, the CNN synthesis layer comprises an upscaling operation to fullresolution followed by a CNN operating at full-resolution. All residue blocks operate at a resolution 1 / s of the resolution of channel X.
[0080] In some implementations, the number of channels output from each residue block may be reduced gradually from co to c„, thereby providing a substantial reduction in computation and model size at only a small loss in accuracy. One way to model the channel decay characteristic of the network is through a parabolic function f(i) yielding the number of input channels ct at the zth residual block. Given Co and a decay ratio parameter d < 1 defined s d= cn / co, a concave-up parabolic function f(i) may be used with f(0) = co, and f(n) = cn= dco as its minima. This becomes the following equation with rounding to an integer.
[0081] Ci =f(i) = round [co(l - t / )(l - z / zz)2 + dco ]
[0082] Where d= 1, there is no channel reduction. In such an implementation, a = co, i = 1, ..., n, and all residue blocks have the same number of input and output channels.
[0083] FIGS. 11 A and 1 IB are diagrams of a residue block architecture that can be used in the network architecture of FIG. 10. Each of FIGS. 11 A and 1 IB illustrates a input channels and +I output channels. The parameters shown at different stages are the number of channels. FIG. 11 A represents the general case where a +I. This architecture includes three convolutions. The bottom branch has two convolutional (CONV) layers 1 and 2 with a non-linear rectifier, also referred to as a Rectified Linear Unit (ReLU) activation function, inbetween. The output of the bottom branch is added to the output from the top branch, which includes a single convolution layer CONV 3, to produce the final residue block output. The special case shown in FIG. 1 IB corresponds to a = a+i. In either case, the first convolutionlayer CONV 1 can expand the number of channels by an expansion factor e > 1. In this way, the number of channels at the output of the first convolution layer CONV 1 that is input to the rectifier ReLU and the second convolution layer CONV 2 is ea. Use of a depthwise separable convolution in each of the convolution layers factorizes a standard convolution into a depthwise convolution and a pointwise convolution, resulting in significant savings in computation and model size with a modest loss in efficacy.
[0084] A 9-tuple [ / / , s, co, d, ko, ki, k2, ks, c [ describes the set of parameters that defines the model architecture where:
[0085] n is the number of residue blocks;
[0086] 5 is the stride of the Analysis CNN 1010;
[0087] co is the number of channels output by the Analysis CNN 1010;
[0088] d is the channel decay ratio;
[0089] ko is the kernel size the Analysis CNN 1010 and the Synthesis CNN 1020;
[0090] ki is the kernel size of CONV 1;
[0091] k2 is the kernel size of CONV 2;
[0092] ks is the kernel size of CONV 3; and
[0093] e is the residue block expansion ratio.
[0094] In some implementations, an encoder may search this 9-parameter hyperparameter space for the model that provides the best solution on a training set of data restored similarly to the current restoration task (e.g., the restoration of the current reconstructed frame). Other techniques for selecting the ML model for a frame at the encoder may be used as described previously.
[0095] For same-resolution restoration, experiments were run with a total of 24 CNNs trained for inter / intra frame types, 6 quality buckets or groups, and luma / chroma channels. The parameters used for the architecture were {n = 6, 5 = 1, co = 32, d= 1, ko = 5, ki = 3, k2 = 5, ks = 3, e = 1 }, which resulted in about 19k model parameters. In an example where both the encoder and decoder used a fixed model for any given frame, compression gains, e.g., as measured by peak signal-to-noise ratio (PSNR) over existing restoration tools as described above occurred in every test set. In another example, the encoder channel was allowed to choose from 3 models for restoration of only the luma channel for any given frame, while the chroma channels were still restored using assigned models. Additional compression gains were achieved as compared to using the fixed model, but these experiments resulted in additional encoder complexity.
[0096] For super-resolution restoration, experiments were run with a total of 24 CNNs trained for 4 resampling ratios (4 down-up ratios of r = 5 / 4, 3 / 2, 7 / 4, 2 / 1) in 3 quality buckets or groups for inter / intra frame types. The parameters used for the architecture were {n = 5, s = 1, co = 20, d= 0.25, ko = 5, ki = 3, k2 = 5, k3 = , e = }, which resulted in about 3.8k model parameters. As in the above experiments, both assigned (fixed) models and selectable models were used. In the assigned model tests, the codec used the model trained for the specific quality bucket in which the actual frame quality value (QPbase) falls into. In the selectable model tests, the encoder was again allowed to choose from 3 models. All cases showed considerable compression gains (as measured by PSNR) over existing restoration tools as described above (e.g., Wiener and / or guided filters), especially at lower resolution videos (720p) with more aggressive downsampling ratios. It is theorized that switchable ML models described herein have a better scope to recover losses than conventional techniques.
[0097] In all experiments described above, all model parameters were quantized to 16-bit integers using post-training quantization to reduce inference complexity and to make the models hardware-friendly.
[0098] It is noted that details of machine learning, neural networks, including convolutional neural networks, and / or details that would be known to a person skilled in the art based on the description herein are omitted or described in brief.
[0099] Switchable ML models on common inference hardware for use in image and video coding are described herein. By using common inference hardware with multiple available classes of parameters for use with the hardware, a small footprint can be used for inferencing, particularly at a decoder. The benefits are illustrated in an example within an inloop restoration framework powered by multiple switchable hardware-feasible CNNs, trained for different quality ranges and frame types for both same-resolution and super-resolution restoration, that are run on a common hardware with downloadable parameters (e.g., weights).
[0100] For simplicity of explanation, the processes herein are depicted and described as a series of blocks, steps, or operations. However, the blocks, steps, or operations in accordance with this disclosure can occur in various orders and / or concurrently. Additionally, other steps or operations not presented and described herein may be used. Furthermore, not all illustrated steps or operations may be required to implement a technique in accordance with the disclosed subject matter.
[0101] The aspects of encoding and decoding described above illustrate some encoding and decoding techniques. However, it is to be understood that “encoding” and “decoding,” as those terms are used in the claims, could mean compression, decompression, transformation, or any other processing or change of data.
[0102] The words “example” or “implementation” are used herein to mean serving as an example, instance, or illustration. Any aspect or design described herein as “example” or “implementation” is not necessarily to be construed as being preferred or advantageous over other aspects or designs. Rather, use of the words “example” or “implementation” is intended to present concepts in a concrete fashion. As used in this application, the term “or” is intended to mean an inclusive “or” rather than an exclusive “or.” That is, unless specified otherwise or clearly indicated otherwise by the context, “X includes A or B” is intended to mean any of the natural inclusive permutations thereof. That is, if X includes A; X includes B; or X includes both A and B, then “X includes A or B” is satisfied under any of the foregoing instances. In addition, the articles “a” and “an” as used in this application and the appended claims should generally be construed to mean “one or more” unless specified otherwise or clear from the context to be directed to a singular form. Moreover, use of the term “an implementation” or “one implementation” throughout is not intended to mean the same embodiment or implementation unless described as such.
[0103] Implementations of the transmitting station 102 and / or the receiving station 106 (and the algorithms, methods, instructions, etc., stored thereon and / or executed thereby, including by the encoder 400 and the decoder 500) can be realized in hardware, software, or any combination thereof. The hardware can include, for example, computers, intellectual property (IP) cores, application-specific integrated circuits (ASICs), programmable logic arrays, optical processors, programmable logic controllers, microcode, microcontrollers, servers, microprocessors, digital signal processors, or any other suitable circuit. In the claims, the term “processor” should be understood as encompassing any of the foregoing hardware, either singly or in combination. The terms “signal” and “data” are used interchangeably. Further, portions of the transmitting station 102 and the receiving station 106 do not necessarily have to be implemented in the same manner.
[0104] Further, in one aspect, for example, the transmitting station 102 or the receiving station 106 can be implemented using a general-purpose computer or general-purpose processor with a computer program that, when executed, carries out any of the respective methods, algorithms, and / or instructions described herein. In addition, or alternatively, forexample, a special-purpose computer / processor, which can contain other hardware for carrying out any of the methods, algorithms, or instructions described herein, can be utilized.
[0105] The transmitting station 102 and the receiving station 106 can, for example, be implemented on computers in a video conferencing system. Alternatively, the transmitting station 102 can be implemented on a server, and the receiving station 106 can be implemented on a device separate from the server, such as a handheld communications device. In this instance, the transmitting station 102, using an encoder 400, can encode content into an encoded video signal and transmit the encoded video signal to the communications device. In turn, the communications device can then decode the encoded video signal using a decoder 500. Alternatively, the communications device can decode content stored locally on the communications device, for example, content that was not transmitted by the transmitting station 102. Other transmitting station 102 and receiving station 106 implementation schemes are available. For example, the receiving station 106 can be a generally stationary personal computer rather than a portable communications device, and / or a device including an encoder 400 may also include a decoder 500.
[0106] Further, all or a portion of implementations of the present disclosure can take the form of a computer program product accessible from, for example, a tangible computer- usable or computer-readable medium. A computer-usable or computer-readable medium can be any device that can, for example, tangibly contain, store, communicate, or transport the program for use by or in connection with any processor. The medium can be, for example, an electronic, magnetic, optical, electromagnetic, or semiconductor device. Other suitable mediums are also available.
[0107] The above-described embodiments, implementations, and aspects have been described to allow easy understanding of the present disclosure and do not limit the present disclosure. On the contrary, the disclosure is intended to cover various modifications and equivalent arrangements included within the scope of the appended claims, which scope is to be accorded the broadest interpretation as is permitted under the law to encompass all such modifications and equivalent arrangements.
Claims
What is claimed is:
1. A method for use in coding image data, comprising: determining a class of input data for inference hardware of a coder; determining, using the class, parameters for a machine-learning model comprising the inference hardware, wherein the parameters comprise one set of multiple sets of unique parameters, each set of the multiple sets is associated with a respective class of input data, and each set of the multiple sets defines a respective machine-learning model comprising the inference hardware such that the inference hardware comprises a common inference architecture implemented in hardware for each class; and generating output data from the machine-learning model.
2. The method of claim 1, wherein the parameters comprise weights and biases for the machine-learning model.
3. The method of one of claim 1 or claim 2, wherein determining the class comprises: decoding, from a bitstream, a class index; and identifying the class using the class index.
4. The method of one of claim 1 or claim 2, wherein determining the class comprises: determining available classes of input data using encoding parameters of the input data, wherein the available classes comprise a proper subset of all classes of input data; and identifying the class from the available classes using a class index.
5. The method of one of claim 1 or claim 2, wherein determining the class comprises: determining a class index from encoding parameters of the input data; and identifying the class using the class index.
6. The method of one of claim 4 or claim 5, wherein the encoding parameters comprise a prediction type of the input data, a quality value of the encoding of the input data, and whether the input data was encoded using super-resolution.
7. The method of any one of claims 1 to 6, wherein determining, using the class, parameters for the machine-learning model comprises identifying the parameters from a storage storing the multiple sets of unique parameters, and each set of the multiple sets is identified by a respective class index.
8. The method of any one of claims 1 to 7, wherein the image data is color data of at least a portion of a video frame.
9. An apparatus for use in coding image data, comprising: an encoder including inference hardware, wherein the encoder is the coder and is configured to perform the method according to any one of claims 1 to 8.
10. An apparatus for use in coding image data, comprising: a decoder including inference hardware, wherein the decoder is the coder and is configured to perform the method according to any one of claims 1 to 8.
11. The apparatus of one of claim 9 or claim 10, wherein the inference hardware comprises an in-loop restoration stage of the coder.
12. An apparatus for use in coding image data, comprising: a coder including inference hardware; and storage storing multiple sets of unique parameters, wherein each set of the multiple sets is associated with a respective class of input data, and each set of the multiple sets defines a respective machine-learning model comprising the inference hardware, and wherein the coder performs a method comprising: determining a class of input data for the inference hardware; determining, using the class, parameters for a machine-learning model comprising the inference hardware, wherein the parameters comprise one set of the multiple sets of unique parameters; andgenerating output data from the machine-learning model.
13. The apparatus of claim 12, wherein the machine-learning model comprises a convolution neural network.
14. The apparatus of one of claim 12 or claim 13, wherein the inference hardware comprises an in-loop restoration stage of an encoder.
15. The apparatus of any one of claims 12 to 14, wherein the inference hardware comprises an in-loop restoration stage of a decoder.
Citation Information
Patent Citations
Multiple neural network models for filtering during video coding
US20220103864A1
