Method and apparatus for video coding and decoding using converter-based in-loop filter
By introducing transformer-based in-loop filters into video coding and decoding technology, and using K continuous transformer blocks and attention operations, the problem of video coding and decoding efficiency and image quality improvement in the existing technology is solved, and a more efficient Video data processing and quality improvement.
Patent Information
- Application Number
- CN202380022095.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-01-18
- Filing Date
- 2023-01-26
- Publication Date
- 2024-09-27
AI Technical Summary
Existing video encoding and decoding technology has limited improvements in encoding and decoding efficiency and image quality when processing high-resolution and high-frame-rate video data. In particular, there is a lack of effective deep learning technology applications in in-loop filtering.
Using a transformer-based in-loop filter, K consecutive transformer blocks and attention operations are used to enhance the image quality of video blocks through a deep learning model and improve video encoding and decoding efficiency.
The video encoding and decoding efficiency and image quality are significantly improved, and the video frame reconstruction effect is enhanced through the transformer-based in-loop filter technology.
Smart Images

Figure CN118715778A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a video coding and decoding method and apparatus using a transformer-based in-loop filter. Background Art
[0002] The statements in this section merely provide background information related to the present invention and may not necessarily constitute prior art.
[0003] Since video data has a large amount of data compared to audio data or still image data, video data requires a large amount of hardware resources (including memory) to store or transmit the video data without being compressed.
[0004] Accordingly, the encoder is generally used to compress and store or transmit video data. The decoder receives the compressed video data, decompresses the received compressed video data, and plays the decompressed video data. Video compression technologies include H.264 / AVC, High Efficiency Video Coding (HEVC), and Versatile Video Coding (VVC), which improves the coding efficiency of HEVC by about 30% or more.
[0005] However, as image size, resolution and frame rate gradually increase, the amount of data to be encoded will also increase. Accordingly, new compression technologies that provide higher codec efficiency and improved image enhancement effects than existing compression technologies are needed. Recently, in addition to Convolutional Neural Networks (CNNs), which are a deep learning technology, transformers are also used to improve the quality of video frames. Especially for in-loop filtering, improving video coding efficiency and enhancing video quality requires effective use of deep learning technologies. Summary of the invention
[0006] Technical issues
[0007] The present invention is directed to providing a video coding method and apparatus that applies a current video block to an attention module of a transformer as a deep learning model to improve video coding efficiency and enhance image quality. The video coding method and apparatus utilize the resulting transformer-based in-loop filter.
[0008] Technical Solution
[0009] At least one aspect of the present invention provides a method for enhancing the image quality of a reconstructed frame performed by a video decoding device. The method includes obtaining an input region of a preset size from a reconstructed frame, wherein the reconstructed frame is a reconstruction of an original frame and has been pre-reconstructed by a video decoding device. The method also includes generating an enhanced video region that approximates the original frame by feeding the input region into an in-loop filter based on deep learning. The in-loop filter includes K consecutive transformer blocks, and K is a natural number. Generating the enhanced video region includes converting the input image into a final output feature based on an attention operation by utilizing K consecutive transformer blocks.
[0010] Another aspect of the present invention provides a method for enhancing the image quality of a reconstructed frame performed by a video encoding device. The method includes obtaining an input region of a preset size from a reconstructed frame, wherein the reconstructed frame is a reconstruction of an original frame and has been pre-reconstructed by a video encoding device. The method also includes generating an enhanced video region that approximates the original frame by feeding the input region into an in-loop filter based on deep learning. The in-loop filter includes K consecutive transformer blocks, and K is a natural number. Generating the enhanced video region includes converting the input image into a final output feature based on an attention operation by utilizing K consecutive transformer blocks.
[0011] Another aspect of the present invention provides a computer-readable recording medium storing a bitstream generated by a video encoding method. The video encoding method includes obtaining an input region of a preset size from a reconstructed frame, wherein the reconstructed frame is a reconstruction of the original frame and has been pre-reconstructed by a video encoding device. The video encoding method also includes generating an enhanced video region that approximates the original frame by feeding the input region into an in-loop filter based on deep learning. The in-loop filter includes K consecutive transformer blocks, and K is a natural number. Generating the enhanced video region includes converting the input image into a final output feature based on an attention operation by utilizing K consecutive transformer blocks.
[0012] Beneficial Effects
[0013] As described above, the present invention provides a video coding method and apparatus, which applies a current video block to an attention module of a transformer as a deep learning model, and utilizes a synthetic transformer-based in-loop filter. Therefore, the video coding method and apparatus improve video coding efficiency and enhance video image quality. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1 is a block diagram of a video encoding device that can implement the technology of the present invention.
[0015] Figure 2 A method of partitioning blocks using a quadtree plus binary tree ternary tree (QTBTTT) structure is shown.
[0016] Figure 3a and Figure 3b Multiple intra prediction modes are shown including a wide-angle intra prediction mode.
[0017] Figure 4 Shows the neighboring blocks of the current block.
[0018] Figure 5 is a block diagram of a video decoding device that can implement the technology of the present invention.
[0019] Figure 6 is a schematic diagram showing the operation of a convolutional layer.
[0020] Figure 7 is a schematic diagram showing a single image super resolution (SISR) network.
[0021] Figure 8 is a schematic diagram showing a residual block used in SISR.
[0022] Fig. 9 is a schematic diagram showing a fixed coefficient in-loop filter based on a convolutional neural network (CNN).
[0023] Fig.10a and Fig.10b is a schematic diagram showing the self-attention of a vector.
[0024] Fig.11a and Fig.11b is a schematic diagram showing the self-attention of a matrix.
[0025] Fig.12 is a schematic diagram showing multi-head attention.
[0026] Fig.13 is a schematic diagram showing the structure of a converter.
[0027] Fig.14 is a schematic diagram showing the input preprocessing of the visual transformer.
[0028] Fig.15 is a schematic diagram illustrating application of attention processing to a current video block according to at least one embodiment of the present invention.
[0029] Fig.16 is a schematic diagram showing regions of merging according to at least one embodiment of the present invention.
[0030] Fig.17is a schematic diagram illustrating a case where an attention score is not calculated according to at least one embodiment of the present invention.
[0031] Fig.18 is a schematic diagram illustrating a transformer-based in-loop filter in accordance with at least one embodiment of the present invention.
[0032] Fig.19a and Fig.19b is a schematic diagram showing a converter block according to an embodiment of the present invention.
[0033] Fig. 20 is a flow chart of a method of enhancing image quality according to at least one embodiment of the present invention.
[0034] Fig.21 is a flow chart of a method for enhancing image quality according to another embodiment of the present invention. DETAILED DESCRIPTION
[0035] Hereinafter, some embodiments of the present invention will be described in detail with reference to the attached illustrative drawings. In the following description, the same reference numerals represent the same elements, although the elements are shown in different drawings. In addition, in the following description of some embodiments, when it is considered that the detailed description of related known components and functions obscures the subject matter of the present invention, the detailed description of related known components and functions may be omitted for the sake of clarity and brevity.
[0036] Figure 1 is a block diagram of a video encoding device that can implement the technology of the present invention. Figure 1 A video encoding device and components of the device are described in detail.
[0037] The encoding device may include: an image divider 110, a predictor 120, a subtractor 130, a transformer 140, a quantizer 145, a rearrangement unit 150, an entropy encoder 155, an inverse quantizer 160, an inverse transformer 165, an adder 170, a loop filtering unit 180 and a memory 190.
[0038] Each component of the encoding device can be implemented as hardware or software, or as a combination of hardware and software. In addition, the function of each component can be implemented as software, and the microprocessor can also be implemented to execute the function of the software corresponding to each component.
[0039] A video consists of one or more sequences including multiple images. Each image is divided into multiple regions, and encoding is performed on each region. For example, an image is divided into one or more tiles or / and slices. Here, one or more tiles can be defined as a tile group. Each tile or / and slice is divided into one or more coding tree units (coding tree unit, CTU). In addition, each CTU is divided into one or more coding units (coding unit, CU) through a tree structure. The information applied to each coding unit (CU) is encoded as the syntax of the CU, and the information commonly applied to the CU included in a CTU is encoded as the syntax of the CTU. In addition, the information commonly applied to all blocks in a slice is encoded as the syntax of the slice header, and the information applied to all blocks constituting one or more images is encoded as a picture parameter set (Picture Parameter Set, PPS) or a picture header. In addition, the information commonly referenced by multiple images is encoded as a sequence parameter set (Sequence Parameter Set, SPS). In addition, the information commonly referenced by one or more SPSs is encoded as a video parameter set (Video Parameter Set, VPS). In addition, information commonly applied to one tile or tile group may also be encoded as syntax of the tile or tile group header.The syntax included in the SPS, PPS, slice header, tile or tile group header may be referred to as a high-level syntax.
[0040] The image divider 110 determines the size of a coding tree unit (CTU). Information on the size of the CTU (CTU size) is encoded as a syntax of an SPS or a PPS and transmitted to a video decoding device.
[0041] The image divider 110 divides each image constituting a video into a plurality of coding tree units (CTUs) having a predetermined size, and then recursively divides the CTUs by using a tree structure. A leaf node in the tree structure becomes a coding unit (CU), which is a basic unit of coding.
[0042] The tree structure can be a quadtree (quadtree, QT), in which a higher node (or parent node) is split into four lower nodes (or child nodes) of the same size. The tree structure can also be a binary tree (binarytree, BT), in which a higher node is split into two lower nodes. The tree structure can also be a ternary tree (ternarytree, TT), in which a higher node is split into three lower nodes at a ratio of 1:2:1. The tree structure can also be a structure in which two or more structures in the QT structure, BT structure and TT structure are mixed. For example, a quadtree plus binary tree (quadtree plus binarytree, QTBT) structure can be used, or a quadtree plus binary tree ternary tree (quadtree plus binarytreeternarytree, QTBTTT) structure can be used. Here, a binary tree ternary tree (BTTT) is added to the tree structure to be called a multiple-type tree (multiple-type tree, MTT).
[0043] Figure 2 is a schematic diagram for describing a method of partitioning a block by using a QTBTTT structure.
[0044] like Figure 2 As shown, the CTU can be first split into a QT structure. The quadtree splitting can be recursive until the size of the split block reaches the minimum block size (MinQTSize) of the leaf node allowed in QT. The first flag (QT_split_flag) indicating whether each node of the QT structure is split into four nodes of the lower layer is encoded by the entropy encoder 155 and notified to the video decoding device with a signal. When the leaf node of QT is not larger than the maximum block size (MaxBTSize) of the root node allowed in BT, the leaf node can be further split into at least one of a BT structure or a TT structure. There may be multiple splitting directions in the BT structure and / or the TT structure. For example, there may be two directions, namely, a direction for horizontally splitting blocks of the corresponding node and a direction for vertically splitting blocks of the corresponding node. As Figure 2 As shown, when MTT splitting starts, the entropy encoder 155 encodes a second flag (mtt_split_flag) indicating whether the node is split, and a flag indicating the splitting direction (vertical or horizontal) and / or a flag indicating the splitting type (binary or trifurcated) when the node is split, and notifies the video decoding device of the same by signal.
[0045] Alternatively, before encoding the first flag (QT_split_flag) indicating whether each node is split into four nodes of the lower layer, the CU split flag (split_cu_flag) indicating whether the node is split may also be encoded. When the value of the CU split flag (split_cu_flag) indicates that each node is not split, the block of the corresponding node becomes a leaf node in the split tree structure and becomes a CU, which is the basic unit of encoding. When the value of the CU split flag (split_cu_flag) indicates that each node is split, the video encoding device first starts encoding the first flag in the above scheme.
[0046] When QTBT is used as another example of a tree structure, there may be two types, namely, a type in which the block of the corresponding node is horizontally split into two blocks of the same size (i.e., symmetrical horizontal splitting) and a type in which the block of the corresponding node is vertically split into two blocks of the same size (i.e., symmetrical vertical splitting). The entropy encoder 155 encodes a split flag (split_flag) indicating whether each node of the BT structure is split into blocks of the lower layer and split type information indicating the split type, and transmits them to the video decoding device. On the other hand, there may be another type in which the block of the corresponding node is split into two blocks that are asymmetric to each other. The asymmetric form may include a form in which the block of the corresponding node is split into two rectangular blocks with a size ratio of 1:3, or may also include a form in which the block of the corresponding node is split in a diagonal direction.
[0047] The CU may have various sizes according to the QTBT or QTBTTT partitioned from the CTU. Hereinafter, the block corresponding to the CU to be encoded or decoded (i.e., the leaf node of the QTBTTT) is referred to as the "current block". When QTBTTT partitioning is adopted, the shape of the current block may also be a rectangular shape in addition to a square shape.
[0048] The predictor 120 predicts the current block to generate a predicted block. The predictor 120 includes an intra predictor 122 and an inter predictor 124.
[0049] Typically, each of the current blocks in an image may be predictively encoded. Typically, the prediction of the current block may be performed by utilizing an intra-prediction technique (which utilizes data from an image including the current block) or an inter-prediction technique (which utilizes data from an image encoded prior to the image including the current block). Inter-prediction includes both unidirectional prediction and bidirectional prediction.
[0050] The intra-frame predictor 122 predicts pixels in the current block by using pixels (reference pixels) located adjacent to the current block in the current image including the current block. There are multiple intra-frame prediction modes according to the prediction direction. For example, Figure 3aAs shown, the plurality of intra prediction modes may include two non-directional modes including a planar mode and a DC mode, and may include 65 directional modes. Neighboring pixels and algorithm equations to be used are defined differently according to each prediction mode.
[0051] In order to perform efficient directional prediction for a current block with a rectangular shape, it is possible to additionally use Figure 3b The directional modes are shown in the dashed arrows (#67 to #80, intra-frame prediction modes #-1 to #-14). The directional modes can be called "wide angle intra-frame prediction modes". Figure 3b In the figure, the arrows indicate the corresponding reference samples used for prediction, rather than representing the prediction direction. The prediction direction is opposite to the direction indicated by the arrow. When the current block has a rectangular shape, the wide-angle intra prediction mode is a mode in which prediction is performed in a direction opposite to the specific direction mode without additional bit transmission. In this case, in the wide-angle intra prediction mode, some wide-angle intra prediction modes available for the current block can be determined by the ratio of the width to the height of the current block having a rectangular shape. For example, when the current block has a rectangular shape with a height less than the width, a wide-angle intra prediction mode (intra prediction modes #67 to #80) with an angle less than 45 degrees is available. When the current block has a rectangular shape with a width greater than the height, a wide-angle intra prediction mode with an angle greater than -135 degrees is available.
[0052] The intra-frame predictor 122 may determine an intra-frame prediction to be used for encoding the current block. In some examples, the intra-frame predictor 122 may encode the current block by utilizing multiple intra-frame prediction modes, and may also select an appropriate intra-frame prediction mode to be used from a test mode. For example, the intra-frame predictor 122 may calculate a rate-distortion value by utilizing a rate-distortion analysis of multiple tested intra-frame prediction modes, and may also select an intra-frame prediction mode having the best rate-distortion characteristic in the test mode.
[0053] The intra-frame predictor 122 selects an intra-frame prediction mode among a plurality of intra-frame prediction modes and predicts the current block by using adjacent pixels (reference pixels) and an algorithm equation determined according to the selected intra-frame prediction mode. Information about the selected intra-frame prediction mode is encoded by the entropy encoder 155 and transmitted to the video decoding device.
[0054] The inter-frame predictor 124 generates a prediction block for the current block by using a motion compensation process. The inter-frame predictor 124 searches for a block that is most similar to the current block in a reference image that has been encoded and decoded earlier than the current image, and generates a prediction block for the current block by using the searched block. In addition, a motion vector (MV) is generated, which corresponds to the displacement between the current block in the current image and the prediction block in the reference image. Typically, motion estimation is performed on the luminance (luma) component, and the motion vector calculated based on the luminance component is used for both the luminance component and the chrominance component. The motion information including information of the reference image and information about the motion vector used to predict the current block is encoded by the entropy encoder 155 and transmitted to the video decoding device.
[0055] The inter-frame predictor 124 may also perform interpolation of a reference image or a reference block to increase the accuracy of the prediction. In other words, a subsample is interpolated between two consecutive integer samples by applying a filter coefficient to a plurality of consecutive integer samples including two integer samples. When performing a process of searching for a block most similar to the current block on the interpolated reference image, a decimal unit precision may be represented for the motion vector instead of an integer sample unit precision. For each target region to be encoded, for example, a unit such as a slice, a tile, a CTU, a CU, etc., the precision or resolution of the motion vector may be set differently. When such an adaptive motion vector resolution (AMVR) is applied, information about the motion vector resolution to be applied to each target region should be signaled for each target region. For example, when the target region is a CU, information about the motion vector resolution applied to each CU is signaled. The information about the motion vector resolution may be information representing the precision of the motion vector difference to be described below.
[0056] On the other hand, the inter-frame predictor 124 may perform inter-frame prediction by utilizing bidirectional prediction. In the case of bidirectional prediction, two reference images and two motion vectors representing the block positions most similar to the current block in each reference image are used. The inter-frame predictor 124 selects a first reference image and a second reference image from a reference image list 0 (RefPicList0) and a reference image list 1 (RefPicList1), respectively. The inter-frame predictor 124 also searches for a block most similar to the current block in the corresponding reference image to generate a first reference block and a second reference block. In addition, a prediction block of the current block is generated by averaging or weighted averaging the first reference block and the second reference block. In addition, motion information including information about two reference images used to predict the current block and including information about two motion vectors is transmitted to the entropy encoder 155. Here, the reference image list 0 may be composed of images that are before the current image in the display order in the pre-reconstructed image, and the reference image list 1 may be composed of images that are after the current image in the display order in the pre-reconstructed image. However, although not particularly limited thereto, the pre-reconstructed image that is after the current image in the display order may be additionally included in the reference image list 0. Conversely, a pre-reconstructed image preceding the current image may also be additionally included in the reference image list 1 .
[0057] In order to minimize the amount of bits consumed for encoding motion information, various methods may be used.
[0058] For example, when the reference image and motion vector of the current block are the same as those of the neighboring block, information capable of identifying the neighboring block is encoded to transmit the motion information of the current block to the video decoding device. This method is called merge mode.
[0059] In the merge mode, the inter predictor 124 selects a predetermined number of merge candidate blocks (hereinafter, referred to as 'merge candidates') from neighboring blocks of the current block.
[0060] As the neighboring blocks for deriving the merge candidate, all or some of the left block A0, the lower left block A1, the upper block B0, the upper right block B1 and the upper left block B2 adjacent to the current block in the current image may be used, such as Figure 4 As shown. In addition, in addition to the current image where the current block is located, a block located in a reference image (which may be the same as or different from the reference image used to predict the current block) may also be used as a merge candidate. For example, a co-located block of the current block in the reference image or a block adjacent to the co-located block may be additionally used as a merge candidate. If the number of merge candidates selected by the above method is less than the preset number, a zero vector is added to the merge candidate.
[0061] The inter-frame predictor 124 configures a merge list including a predetermined number of merge candidates by using adjacent blocks. A merge candidate to be used as motion information of the current block is selected from among the merge candidates included in the merge list, and merge index information for identifying the selected candidate is generated. The generated merge index information is encoded by the entropy encoder 155 and transmitted to the video decoding device.
[0062] Merge skip mode is a special case of merge mode. After quantization, when all transform coefficients for entropy coding are close to zero, only the neighbor block selection information is transmitted without the residual signal. By using merge skip mode, relatively high coding efficiency can be achieved for images with slight motion, still images, screen content images, etc.
[0063] Hereinafter, merge mode and merge skip mode are collectively referred to as merge / skip mode.
[0064] Another method for encoding motion information is the advanced motion vector prediction (AMVP) mode.
[0065] In the AMVP mode, the inter-frame predictor 124 derives a motion vector prediction candidate for a motion vector of a current block by using neighboring blocks of the current block. As neighboring blocks for deriving motion vector prediction candidates, the neighboring blocks may be used. Figure 4 All or some of the left block A0, lower left block A1, upper block B0, upper right block B1 and upper left block B2 adjacent to the current block in the current image shown. In addition, in addition to the current image where the current block is located, blocks located in a reference image (which may be the same as or different from the reference image used to predict the current block) may also be used as adjacent blocks for deriving motion vector prediction candidates. For example, a co-located block of the current block in the reference image or a block adjacent to the co-located block may be used. If the number of motion vector candidates selected by the above method is less than the preset number, a zero vector is added to the motion vector candidates.
[0066] The inter-frame predictor 124 derives a motion vector prediction candidate by using the motion vectors of the neighboring blocks, and determines a motion vector prediction of the motion vector of the current block by using the motion vector prediction candidate. In addition, a motion vector difference is calculated by subtracting the motion vector prediction from the motion vector of the current block.
[0067] The motion vector prediction can be obtained by applying a predefined function (e.g., median and mean calculations, etc.) to the motion vector prediction candidate. In this case, the video decoding device also knows the predefined function. In addition, since the neighboring blocks used to derive the motion vector prediction candidate are blocks that have completed encoding and decoding, the video decoding device may also already know the motion vectors of the neighboring blocks. Therefore, the video encoding device does not need to encode the information for identifying the motion vector prediction candidate. Accordingly, in this case, information about the motion vector difference and information about the reference image used to predict the current block are encoded.
[0068] On the other hand, the motion vector prediction can also be determined by selecting any one of the motion vector prediction candidates. In this case, information for identifying the selected motion vector prediction candidate is additionally encoded together with information about the motion vector difference used to predict the current block and information about the reference image.
[0069] The subtractor 130 generates a residual block by subtracting a prediction block generated by the intra predictor 122 or the inter predictor 124 from the current block.
[0070] The transformer 140 transforms the residual signal in the residual block having the pixel value of the spatial domain into the transform coefficient of the frequency domain. The transformer 140 may transform the residual signal in the residual block by using the entire size of the residual block as the transform unit, or may also divide the residual block into a plurality of sub-blocks, and may perform the transform by using the sub-block as the transform unit. Alternatively, the residual block is divided into two sub-blocks, namely, a transform region and a non-transform region, so as to transform the residual signal by using only the transform region sub-block as the transform unit. Here, the transform region sub-block may be one of two rectangular blocks having a size ratio of 1:1 based on the horizontal axis (or the vertical axis). In this case, the entropy encoder 155 encodes a flag (cu_sbt_flag) indicating that only the sub-block is transformed, and direction (vertical / horizontal) information (cu_sbt_horizontal_flag) and / or position information (cu_sbt_pos_flag), and notifies the video decoding device with a signal. In addition, the size of the transform region subblock may have a size ratio of 1:3 based on the horizontal axis (or vertical axis). In this case, a flag (cu_sbt_quad_flag) for dividing the corresponding partition is additionally encoded by the entropy encoder 155 and signaled to the video decoding apparatus.
[0071] On the other hand, the transformer 140 may perform transformation of the residual block separately in the horizontal direction and the vertical direction. For the transformation, various types of transformation functions or transformation matrices may be used. For example, paired transformation functions for horizontal transformation and vertical transformation may be defined as a multiple transform set (MTS). The transformer 140 may select a transformation function pair with the highest transformation efficiency in the MTS, and may transform the residual block in each of the horizontal and vertical directions. The information (mts_idx) about the transformation function pair in the MTS is encoded by the entropy encoder 155 and notified to the video decoding device with a signal.
[0072] The quantizer 145 quantizes the transform coefficients output from the transformer 140 using the quantization parameters and outputs the quantized transform coefficients to the entropy encoder 155. The quantizer 145 may also quantize the relevant residual block immediately without transforming any block or frame. The quantizer 145 may also apply different quantization coefficients (scaling values) according to the position of the transform coefficients in the transform block. The quantization matrix applied to the quantized transform coefficients arranged in two dimensions may be encoded and signaled to the video decoding device.
[0073] The rearrangement unit 150 may perform rearrangement of coefficient values on the quantized residual value.
[0074] The rearrangement unit 150 can change the 2D coefficient array into a 1D coefficient sequence by using coefficient scanning. For example, the rearrangement unit 150 can use a zig-zag scan or a diagonal scan to scan the DC coefficient to the coefficient of the high frequency region to output a 1D coefficient sequence. Depending on the size of the transform unit and the intra-frame prediction mode, the zig-zag scan can also be replaced by a vertical scan that scans the 2D coefficient array in the column direction and a horizontal scan that scans the 2D block type coefficient in the row direction. In other words, depending on the size of the transform unit and the intra-frame prediction mode, the scanning method to be used can be determined among zig-zag scanning, diagonal scanning, vertical scanning, and horizontal scanning.
[0075] The entropy encoder 155 encodes the sequence of 1D quantized transform coefficients output from the rearrangement unit 150 by using various encoding schemes including Context-based Adaptive Binary Arithmetic Code (CABAC), Exponential Golomb, etc. to generate a bitstream.
[0076] In addition, the entropy encoder 155 encodes information related to block segmentation (e.g., CTU size, CTU segmentation flag, QT segmentation flag, MTT segmentation type, and MTT segmentation direction, etc.) so that the video decoding device can segment the block equivalent to the video encoding device. In addition, the entropy encoder 155 encodes information about the prediction type indicating whether the current block is encoded by intra-frame prediction or inter-frame prediction. The entropy encoder 155 encodes intra-frame prediction information (i.e., information about intra-frame prediction mode) or inter-frame prediction information (merge index in the case of merge mode, and information about reference image index and motion vector difference in the case of AMVP mode) according to the prediction type. In addition, the entropy encoder 155 encodes information related to quantization (i.e., information about quantization parameters and information about quantization matrices).
[0077] The inverse quantizer 160 inversely quantizes the quantized transform coefficient output from the quantizer 145 to generate a transform coefficient. The inverse transformer 165 transforms the transform coefficient output from the inverse quantizer 160 from the frequency domain to the spatial domain to reconstruct a residual block.
[0078] The adder 170 adds the reconstructed residual block and the prediction block generated by the predictor 120 to reconstruct the current block. When intra-prediction is performed on the next block, the pixels in the reconstructed current block are used as reference pixels.
[0079] The loop filtering unit 180 performs filtering on the reconstructed pixels to reduce blocking artifacts, ringing artifacts, blurring artifacts, etc. that occur due to block-based prediction and transform / quantization. The loop filtering unit 180 as an in-loop filter may include all or some of a deblocking filter 182, a sample adaptive offset (SAO) filter 184, and an adaptive loop filter (ALF) 186.
[0080] The deblocking filter 182 filters the boundaries between the reconstructed blocks to remove blocking artifacts that occur due to block unit encoding / decoding, and the SAO filter 184 and the ALF 186 perform additional filtering on the deblocking filtered video. The SAO filter 184 and the ALF 186 are filters for compensating for the difference between the reconstructed pixels and the original pixels that occur due to lossy coding. The SAO filter 184 applies an offset in units of CTU to enhance subjective image quality and encoding efficiency. On the other hand, the ALF 186 performs block unit filtering and applies different filters to compensate for distortion by dividing the boundaries of the corresponding blocks and the degree of the amount of change. Information about the filter coefficients to be used for the ALF can be encoded and notified to the video decoding device with a signal.
[0081] The reconstructed blocks filtered by the deblocking filter 182, the SAO filter 184, and the ALF 186 are stored in the memory 190. When all blocks in one image are reconstructed, the reconstructed image can be used as a reference image for inter-frame prediction of blocks within an image to be subsequently encoded.
[0082] Figure 5 is a functional block diagram of a video decoding device that can implement the technology of the present invention. Figure 5 , describes a video decoding device and components of the device.
[0083] The video decoding apparatus may include an entropy decoder 510 , a rearrangement unit 515 , an inverse quantizer 520 , an inverse transformer 530 , a predictor 540 , an adder 550 , a loop filtering unit 560 , and a memory 570 .
[0084] Similar to Figure 1 Each component of the video encoding device and the video decoding device can be implemented as hardware or software, or as a combination of hardware and software. In addition, the function of each component can be implemented as software, and the microprocessor can also be implemented to execute the function of the software corresponding to each component.
[0085] The entropy decoder 510 extracts information related to block partitioning by decoding a bitstream generated by a video encoding apparatus to determine a current block to be decoded, and extracts prediction information required to reconstruct the current block and information about a residual signal.
[0086] The entropy decoder 510 determines the size of the CTU by extracting information about the CTU size from a sequence parameter set (SPS) or a picture parameter set (PPS), and divides the image into CTUs of the determined size. In addition, the CTU is determined as the highest level (i.e., the root node) of the tree structure, and the partition information of the CTU is extracted to partition the CTU by using the tree structure.
[0087] For example, when CTU is segmented by using the QTBTTT structure, the first flag (QT_split_flag) related to the segmentation of QT is first extracted to segment each node into four nodes of the lower layer. In addition, the second flag (mtt_split_flag) related to the segmentation of MTT, the segmentation direction (vertical / horizontal) and / or the segmentation type (binary / tripartite) are extracted with respect to the node corresponding to the leaf node of QT to segment the corresponding leaf node into the MTT structure. As a result, each node below the leaf node of QT is recursively segmented into a BT or TT structure.
[0088] As another example, when a CTU is split by using a QTBTTT structure, a CU split flag (split_cu_flag) indicating whether the CU is split is extracted. When the corresponding block is split, a first flag (QT_split_flag) may also be extracted. During the splitting process, for each node, 0 or more recursive MTT splits may occur after 0 or more recursive QT splits. For example, for a CTU, MTT splits may occur immediately, or, conversely, multiple QT splits may occur only.
[0089] As another example, when CTU is segmented by using the QTBT structure, the first flag (QT_split_flag) related to the segmentation of the QT is extracted to segment each node into four nodes of the lower layer. In addition, the segmentation flag (split_flag) indicating whether the node corresponding to the leaf node of the QT is further segmented into BT and the segmentation direction information are extracted.
[0090] On the other hand, when the entropy decoder 510 determines the current block to be decoded by using the partitioning of the tree structure, the entropy decoder 510 extracts information about the prediction type indicating whether the current block is intra-predicted or inter-predicted. When the prediction type information indicates intra-prediction, the entropy decoder 510 extracts syntax elements of intra-prediction information (intra-prediction mode) for the current block. When the prediction type information indicates inter-prediction, the entropy decoder 510 extracts information representing syntax elements of inter-prediction information, that is, a motion vector and a reference image to which the motion vector refers.
[0091] In addition, the entropy decoder 510 extracts quantization-related information and extracts information on a quantized transform coefficient of the current block as information on a residual signal.
[0092] The rearrangement unit 515 may change the sequence of 1D quantized transform coefficients entropy-decoded by the entropy decoder 510 into a 2D coefficient array (ie, block) again in the reverse order of the coefficient scanning order performed by the video encoding device.
[0093] The inverse quantizer 520 inversely quantizes the quantized transform coefficients, and inversely quantizes the quantized transform coefficients by using quantization parameters. The inverse quantizer 520 may also apply different quantization coefficients (scaling values) to the quantized transform coefficients arranged in 2D. The inverse quantizer 520 may perform inverse quantization by applying a matrix of quantization coefficients (scaling values) from a video encoding device to a 2D array of quantized transform coefficients.
[0094] The inverse transformer 530 reconstructs a residual signal by inversely transforming the inversely quantized transform coefficient from the frequency domain to the spatial domain to generate a residual block of the current block.
[0095] In addition, when the inverse transformer 530 inversely transforms a partial region (sub-block) of the transform block, the inverse transformer 530 extracts a flag (cu_sbt_flag) that only the sub-block of the transform block is transformed, direction (vertical / horizontal) information (cu_sbt_horizontal_flag) of the sub-block, and / or position information (cu_sbt_pos_flag) of the sub-block. The inverse transformer 530 also inversely transforms the transform coefficient of the corresponding sub-block from the frequency domain to the spatial domain to reconstruct the residual signal, and fills the region that is not inversely transformed with a value of "0" as the residual signal to generate a final residual block of the current block.
[0096] In addition, when MTS is applied, the inverse transformer 530 determines the transform index or transform matrix to be applied in each of the horizontal and vertical directions by using the MTS information (mts_idx) signaled from the video encoding device. The inverse transformer 530 also performs inverse transform on the transform coefficients in the transform block in the horizontal and vertical directions by using the determined transform function.
[0097] The predictor 540 may include an intra predictor 542 and an inter predictor 544. The intra predictor 542 is activated when the prediction type of the current block is intra prediction, and the inter predictor 544 is activated when the prediction type of the current block is inter prediction.
[0098] The intra predictor 542 determines an intra prediction mode of a current block among a plurality of intra prediction modes according to syntax elements of the intra prediction mode extracted from the entropy decoder 510. The intra predictor 542 also predicts the current block by using neighboring reference pixels of the current block according to the intra prediction mode.
[0099] The inter predictor 544 determines a motion vector of a current block and a reference image to which the motion vector refers by using a syntax element of the inter prediction mode extracted from the entropy decoder 510 .
[0100] The adder 550 reconstructs the current block by adding the residual block output from the inverse transformer 530 and the prediction block output from the inter predictor 544 or the intra predictor 542. When intra-predicting a subsequent block to be decoded, pixels within the reconstructed current block are used as reference pixels.
[0101] The loop filtering unit 560 as an in-loop filter may include a deblocking filter 562, an SAO filter 564, and an ALF 566. The deblocking filter 562 performs deblocking filtering on the boundary between the reconstructed blocks in order to remove block artifacts that occur due to block unit decoding. The SAO filter 564 and the ALF 566 perform additional filtering on the reconstructed blocks after deblocking filtering in order to compensate for the difference between the reconstructed pixels and the original pixels that occurs due to lossy encoding. The filter coefficients of the ALF are determined by using information about the filter coefficients decoded from the bitstream.
[0102] The reconstructed blocks filtered by the deblocking filter 562, the SAO filter 564, and the ALF 566 are stored in the memory 570. When all blocks in one image are reconstructed, the reconstructed image can be used as a reference image for inter-frame prediction of blocks within an image to be subsequently encoded.
[0103] In some embodiments, the present invention relates to encoding and decoding video images as described above. More specifically, the present invention provides a video encoding and decoding method and apparatus for applying a current video block to an attention module of a transformer as a deep learning model and utilizing a synthetic transformer-based in-loop filter.
[0104] The following implementation scheme may be performed by the loop filtering unit 180 in the video encoding apparatus. The following implementation scheme may also be performed by the loop filtering unit 542 in the video decoding apparatus.
[0105] The video encoding device that performs in-loop filtering of the reconstructed frame can generate signaling information associated with the present embodiment from the perspective of optimizing rate distortion. The video encoding device can encode the signaling information using the entropy encoder 155, and can send the encoded signaling information to the video decoding device. The video decoding device can decode the signaling information associated with the in-loop filtering of the reconstructed frame from the bitstream using the entropy decoder 510.
[0106] In the following description, the term "target block" may be used interchangeably with a current block or a coding unit (CU). The term "target block" may refer to some areas of a coding unit.
[0107] In addition, a flag value of true indicates a case where the flag is set to 1. In addition, a flag value of false indicates a case where the flag is set to 0.
[0108] I. Convolutional Neural Network (CNN)
[0109] CNN refers to a neural network composed of multiple convolutional layers and pooling layers, and is known to be the best deep learning technique for image processing. The convolutional layer extracts feature maps (or "features" interchangeably in this article) by utilizing multiple kernels or filters. The kernel coefficients that make up the filter are parameters determined during the learning process.
[0110] In the convolutional layers of a CNN, the front layers close to the input extract feature maps that respond to simple and low-level image features (e.g., lines, points, or surfaces), while the back layers close to the output extract feature maps that respond to higher-level features (e.g., textures and object parts).
[0111] Figure 6 is a schematic diagram illustrating the operation of a convolutional layer according to at least one embodiment of the present invention.
[0112] The convolutional layer generates feature maps from the input image using convolution operations. Figure 6 The example of shows a kernel (or filter) with a kernel size of 3×3. The kernel size is also called the filter size. The kernel has kernel parameters or filter parameters, also called weights. Figure 6 The kernel shown has a total of nine kernel parameters. The kernel parameters can be initially set to arbitrary values, and their values can be updated based on training.
[0113] The convolutional layer performs a convolution operation by utilizing a patch of the input image equal to the kernel size. In this case, the kernel-sized patch of the input image is called a window.
[0114] When filtering is performed on an input image in raster scan order, the amount by which the window is moved is called the stride. Figure 6 In the example, the stride is 1. If the stride is set to 2, the convolution operation is performed with a window spacing of 2 samples, resulting in feature maps with horizontal and vertical dimensions that are half of the horizontal and vertical dimensions of the input image.
[0115] As mentioned above, a convolutional layer can include multiple filters. The number of filters or the number of kernels is called channels. The number of channels is equal to the number of filters. The number of filters also determines the dimensionality of the feature map.
[0116] Padding refers to a method of expanding the input data by filling specific values around the input data before performing the convolution operation. Padding is mainly used to control the spatial size of the output data. The value used for padding can be determined by a hyperparameter, but zero padding is usually used. Without padding, the spatial size of the output data decreases with each convolution layer, which may cause boundary information to be lost. Therefore, in order to avoid this problem, padding is used, that is, padding can be used to balance the spatial size of the output data with the spatial size of the input data of the convolution layer.
[0117] The deconvolution layer performs the opposite operation of the convolution layer. The deconvolution layer produces the desired data image as output from the feature map taken as input.
[0118] The pooling layer performs pooling, which is the process of subsampling the feature maps generated by the convolutional layer. The pooling layer utilizes a 2×2 window to select samples so that the output is half the width and half the height of the input. In other words, the pooling layer is used to reduce the size of the input image or input feature map by condensing a 2×2 region into a single sample.
[0119] The opposite concept of pooling layer is defined as unpooling layer. In contrast to pooling layer, unpooling layer is used to increase the dimension and is usually used after deconvolution layer.
[0120] The convolutional encoder-decoder structure is a network structure consisting of pairs of convolutional layers and deconvolutional layers. The convolutional encoder consists of convolutional layers and pooling layers, which output feature maps (or feature vectors) from the input image. The final output vector of the convolutional encoder is sometimes called a latent vector. The convolutional decoder consists of deconvolutional layers and de-pooling layers to generate an output image from the feature map or latent vector.
[0121] The input and output of the convolutional encoder-decoder can vary depending on the application and the purpose of the network. For example, the input and output can be optical flow maps, saliency maps, image frames, etc.
[0122] Figure 7 is a schematic diagram showing a single image super-resolution (SISR) network.
[0123] An example application of CNN is single image super-resolution (SISR). A SISR network produces a high-resolution image as output from a low-resolution input image. A SISR network can include multiple convolutional layers, such as Figure 7As shown in Figure 1, each convolutional layer includes an activation function, such as a rectified linear unit (ReLU). The parameters of the SISR network can be trained so that the resulting super-resolution (SR) image is close to the ground truth (GT).
[0124] SR methods using CNN can improve SR performance by increasing the depth (e.g., by increasing the number of convolutional layers). In order to overcome the overfitting problem in learning that may occur with increasing depth, residual blocks that can perform skip connections and residual learning can be utilized in SISR networks. In addition to applying convolution operations to the input features x l In addition to the path of , the residual block includes a skip path, such as Figure 8 As shown. The residual block can also generate output x l+1 The convolution operation path or skip path is selected based on learning efficiency. Figure 8 In the example of , the residual block includes a batch normalization (BN) layer.
[0125] In one example, the enhanced deep residual network (EDSR) for SISR increases the depth by continuously cascading residual blocks to enhance the performance of the network. Another example is accurate image super-resolution using a very deep convolutional network (VDSR), which is a CNN model based on the Visual Geometry Group (VGG) network that uses residual learning to add residual frames to the final output. VDSR adds the residual signal to the input signal by adding the residual signal at the very end of the network.
[0126] As another example, CNN can be used as an in-loop filter in a video encoding device or a video decoding device. In this case, the in-loop filter based on deep learning can be applied anywhere within the existing loop filtering unit 180, 560 composed of a deblocking filter, an SAO filter, and an ALF.
[0127] As an in-loop filter based on deep learning, there is a fixed coefficient in-loop filter. The fixed coefficient deep learning in-loop filter uses the same CNN kernel parameters stored on the video encoding device side and the video decoding device side.
[0128] Fig. 9 is a schematic diagram showing a CNN-based fixed coefficient in-loop filter.
[0129] The input block (or input frame) passes through the normalized QP map before being passed to the subsequent stage. The normalized QP map is used to reduce the inference error when mixing quantization noise of different strengths during learning and inference. The kernel parameters that constitute the dense residual unit (DRU) and the convolutional layer can be stored and used identically in the video encoding device and the video decoding device. Fig. 9 In the example of , each DRU may include all or some of the convolutional layers, ReLU layers, or depth-wise separable convolutional (DSC) layers.
[0130] Fixed coefficient deep learning in-loop filters have the disadvantage of increasing the number of layers in the CNN and correspondingly increasing the computation time, since the fixed coefficient deep learning in-loop filters need to provide overall performance over a wide range of video frames.
[0131] II. Converter
[0132] Transformers are models proposed for performing sequence-to-sequence tasks in natural language processing, such as machine translation.
[0133] Traditional sequence-to-sequence models include an encoder-decoder structure that utilizes a recurrent neural network (RNN) or long short-term memory (LSTM) to output output words in sequence as input words are fed in. The encoder represents the input sequence as a vector representation, and the decoder generates an output sequence based on the vector representation.
[0134] However, RNN-based models are limited by the limited length of the input vector. In addition, RNN models are limited in processing complex sentences because some input sequence information is lost during the encoding process. To compensate for this, context vectors are generated based on an attention mechanism that associates the output of the decoder at a specific time with the output of the encoder, but the RNN model does not overcome the above limitations.
[0135] The Transformer maintains the traditional encoder-decoder structure by using only attention and outperforms existing models in translation performance despite not using RNN or LSTM.
[0136] Before the overall structure of the Transformer, the self-attention used in the Transformer is described.
[0137] Fig.10a and Fig.10b is a schematic diagram showing the self-attention of a vector.
[0138] Self-attention is performed by an attention module (or “attention layer”) within the Transformer. In the following, assume that the Transformer sequentially processes the sentence “I am a student” and the attention module currently processes the input word “student”.
[0139] First, the attention module multiplies the word vector corresponding to each word initially input into the transformer by a weight matrix to generate a query (Query, Q) vector, a keyword (Key, K) vector, and a value (Value, V) vector, as shown in Fig.10a As shown. Fig.10a In the example, the weight matrix W Q , W K and W V are the training parameters. In addition, for the input word "student", Q student , K student and V student They represent Q vector, K vector and V vector respectively.
[0140] Then, for a given Q vector, the attention module calculates the attention score with all K vectors. The attention module then applies the similarity or attention score as a weight to the V vector mapped to each K vector. Finally, the attention module can perform a weighted sum of all V vectors reflecting similarity to calculate the attention value of the input word.
[0141] The attention score can be calculated by scaled dot product attention, which uses the inner product of two vectors, such as Fig.10b The scaled dot product attention can be expressed as Equation 1.
[0142] [Equation 1]
[0143]
[0144] Here, d k are predefined constants.
[0145] The attention score function represents the degree of association between the q vector and the k vector. In Equation 1, the score function uses the inner product, but the score function can also use any similarity between the two vectors, such as cosine similarity, correlation, etc.
[0146] The above operation can be applied in parallel to all of "I", "am", and "a" except "student", such as Fig.11a and Fig.11b . Fig.11a and Fig.11bIn the example of , for the input sentence “I am a student”, Q, K, and V represent the Q matrix, K matrix, and V matrix, respectively. The final attention value matrix can be calculated as shown in Equation 2.
[0147] [Equation 2]
[0148]
[0149] Here, B is a matrix of predefined positional encoding values. Fig.11b In the example, B is omitted.
[0150] Fig.12 is a schematic diagram showing multi-head attention.
[0151] On the other hand, performing parallel attention is more effective than single attention for learning generalization. This is due to the fact that different weights can be used to collect information from different perspectives on each word vector. In the Transformer, parallel attention is represented by multi-head attention.
[0152] To apply multi-head attention, the weight matrix W Q , W K and W V The number of attention heads (num_heads) can be trained. Fig.12 As shown, the weight matrix W can be used Q 0...num_head-1 , W K 0...num_head-1 and W V 0...num_head-1 to perform parallel attention. The attention output from each head can then be concatenated, multiplied by the weight matrix, and the final attention can be generated.
[0153] Fig.13 is a schematic diagram showing the structure of a converter.
[0154] The transformer includes N encoders and N decoders.
[0155] The encoder includes N layers. One layer includes two sublayers, namely self-attention and feedforward neural network. Here, self-attention refers to the case where Q, K, and V are equal. In addition, the self-attention layer of the encoder performs multi-head attention as described above.
[0156] On the other hand, the input sentence of the encoder is positionally encoded. The transformer may not receive words in sequence. Therefore, in order to represent the position information of the word, the position information is added in token order by using a sine function. Fig.13 In the examples in , “input embedding” refers to the input sentence represented in the form of an embedding.
[0157] The decoder consists of N layers, the same as the encoder. The layer consists of three sub-layers. As with the encoder, the sentence matrix after positional encoding is input to the decoder. Fig.13 In the example above, “output embedding” refers to the input sentence to the decoder represented in the form of an embedding.
[0158] As with sequence-to-sequence, the first sublayer of the decoder is trained based on tutor supervision, where the GT is given as the next input to the decoder, so the decoder is trained to predict the word at each time point given the matrix of the target sentence. The matrix based on the input sentence is masked to avoid referencing words at future time points, thereby referencing itself and previous words. Basically, the first sublayer of the decoder is structurally identical to the first sublayer of the encoder, due to the fact that the first sublayer of the decoder is self-attentional and performs multi-head attention. The behavior of the first sublayer of the decoder is called look-ahead attention.
[0159] The second sublayer of the decoder calculates the attention score matrix by using the output of the first self-attention layer as the Q matrix and using the K matrix and V matrix from the last layer of the encoder. The second sublayer of the decoder is called encoder-decoder attention. On the other hand, the third sublayer is a feed-forward neural network.
[0160] In the field of visual processing, CNN structures are often used. Based on the results of transformers utilized in natural language processing, standard transformers can be modified to a minimum, and then the modified transformer can be directly applied to image processing. To do this, the image can be partitioned into patches, which can be processed in the same way as word units in NLP. A linear embedding sequence of these patches can be fed into the transformer. Transformers used in visual applications are called visual transformers.
[0161] Fig.14 is a schematic diagram showing the input preprocessing of the visual transformer.
[0162] The standard transformer receives a 1D sequence of word embeddings as input. To feed a 1D sequence to the visual transformer, the 2D image needs to be preprocessed. To do this, the 2D input image x∈R W×H×C becomes a series of flattened patches, xp∈R N ×P×P×C ,like Fig.14 As shown in Figure 1, each patch into which the two-dimensional input image is divided is of size P × P. N is the number of patches, and C represents the dimension of color information.
[0163] Alternatively, instead of utilizing image patches, feature maps of a CNN can be used as an input sequence.
[0164] The following embodiments are described with a focus on a video encoding apparatus, but are equally applicable to a video decoding apparatus.
[0165] III. Transformer-Based In-Loop Filter
[0166] Fig.15 is a schematic diagram illustrating application of attention processing to a current video block according to at least one embodiment of the present invention.
[0167] exist Fig.15 In the example of , a video frame of size W×H is divided into video blocks. The current video block (hereinafter, "current block") outputs attention scores of itself and other blocks in the frame by using the attention function shown in the above equations 1 and 2. In equations 1 and 2, the attention function uses the inner product, but the similarity between two blocks can also be used, such as cosine similarity, correlation, mean squared error (MSE), sum of absolute difference (SAD), etc.
[0168] The input patches of the attention function are located in an N×M grid and do not overlap with each other. Alternatively, the input patches can overlap outside the grid. Fig.15 As shown, by setting the current block as a query and calculating the attention score between the current block and the adjacent blocks, the attention value vector of the current block can be output. In order to utilize Equation 1 and Equation 2, it may be necessary to change the two-dimensional current block into a one-dimensional vector. Fig.15 Among the attention scores shown, the second vector from the top represents the self-attention score of the current block itself, and the remaining vectors represent the attention scores of neighboring blocks.
[0169] In this case, the video chunks of the attention module applied to compute the attention function can be defined as follows.
[0170] A video block may be used as a basic unit for encoding, such as a CTU, a CU, a prediction unit (PU), etc. The width and height of a video block are equal. Alternatively, a video block may have different widths and heights.
[0171] The video block may be used after being divided into sub-blocks. The sub-blocks may be used with a fixed width and height, such as a size of 4×4. Alternatively, the size may be set to A / S using a scaling factor S. Here, A represents the width or height of the video block before partitioning.
[0172] like Fig.16 As shown in the example of , regions can be generated by combining multiple video blocks. In this case, the region ( Fig.16The window in the example of ) can be divided into blocks of arbitrary size.
[0173] The two video blocks utilized in the attention operation shown in Equation 1 have the same size. If the two video blocks utilized in the attention calculation are of different sizes, padding is utilized to equalize the two video blocks in size.
[0174] The existing video block may be downsampled and used as input to the attention function. Alternatively, the original video block may be upsampled and used as input to the attention function. Alternatively, the existing video block may be downsampled, upsampled, and then used as input to the attention function.
[0175] On the other hand, in the following cases, the present invention does not calculate the attention score between two video blocks.
[0176] If two video blocks are located at Fig.16 If the window is different from the area (i.e., window) defined in , the attention score is not calculated.
[0177] If two video blocks are in different CTUs, no attention score is calculated.
[0178] like Fig.17 As shown in the example of , if two video blocks exist in different virtual pipeline data units (VPDUs), the attention score is not calculated. Here, VPDU is a data unit that can be processed by a virtual pipeline. VPDU is the largest unit that can be encoded and decoded at a time, and can be used to reduce the cost of hardware implementation caused by the increase in CTU size. In addition, VPDU refers to a data processing unit for encoding and decoding, which is not necessarily limited to the term VPDU.
[0179] For blocks decoded after the current block, the attention score between the related blocks and the current block may not be calculated.
[0180] The video encoding apparatus may apply image reconstruction and denoising techniques using a visual transformer to in-loop filtering to improve the quality of reconstructed frames.
[0181] Fig.18 is a schematic diagram illustrating a transformer-based in-loop filter in accordance with at least one embodiment of the present invention.
[0182] The transformer-based in-loop filter (hereinafter, "in-loop filter") uses one of the input or output of the deblocking filter 182, the SAO filter 184, or the ALF 186 as an input image. The video encoding apparatus selects an input region x∈R from the input image. w×h×CHere, w and h represent the width and height of the input region. C represents the dimension of the color information.
[0183] The in-loop filter can use the object block directly as the input of the transformer. Fig.18 As shown in the example of 0 ∈R w×h×C And use the extracted features as input. Then, the in-loop filter uses K consecutive transformer blocks to generate the features f 1 To feature f K . Feature f 1 To feature f K The dimension and f 0 The dimensions are the same.
[0184] The video encoding device converts the feature f K Input to a neural network that performs arbitrary image reconstruction to generate an image that corresponds to the input region x∈R w×h×C The corresponding enhanced video area. At this time, as the structure of the neural network for image reconstruction, EDSR, VDSR, etc. as described above can be used.
[0185] Fig.19a and Fig.19b is a schematic diagram showing a converter block according to an embodiment of the present invention.
[0186] like Fig.19a As shown in the example of , the transformer block can include consecutive transformer layers. In this case, the last convolutional layer can be optionally placed.
[0187] like Fig.19b As shown in the example of , the transformer blocks can be organized as residual blocks of consecutive transformer layers by utilizing skip connections. In this case, the last convolutional layer can be placed selectively. In this way, as Figure 8 and Fig. 9 The residual blocks of the convolutional layers shown are applied to the Transformer layers.
[0188] on the other hand, Fig.19a A transformer layer as shown can be constructed according to Fig.13 Here, N=1 is set so that the transformer layer has one encoder layer and one decoder layer.
[0189] The input to the transformer block is f i ∈R w×h×C (i=0, 1, ..., K-1), such as Fig.18 If there is no CNN before the first transformer block, the input region x∈R w×h×C Can be used to replace f 0as the input of the first transformer block. The transformer block partitions its input into overlapping and non-overlapping patches and converts each partitioned patch into features. The input of each transformer block can correspond to Fig.16 The window shown in , and the patches can be the video blocks into which the window is partitioned. Each patch can have a size of P×P, as shown in Fig.15 Alternatively, the patches may be of different arbitrary sizes.
[0190] The converter block can be implemented by using Fig.10a , Fig.10b and the self-attention operation of Equation 1 to compute the features of each patch.
[0191] At this time, if each patch falls outside the CTU boundary or outside the VPDU boundary, the self-attention of the patch is not calculated. If part of the partitioned patch is outside the boundary, the self-attention of the patch is not calculated by using a mask for marking such out-of-bounds part.
[0192] Alternatively, if each patch is later in decoding order than the current block, self-attention is not calculated for that patch. If some regions of the segmented patch exist in a later order, self-attention may not be calculated for that region of the patch by utilizing a mask for marking such patch regions that exist in a later order.
[0193] On the other hand, the transformer-based in-loop filter may be a fixed coefficient in-loop filter. Accordingly, the parameters constituting the CNN and each transformer block included in the in-loop filter may be used after being pre-trained and stored identically in the video encoding device and the video decoding device.
[0194] The following describes a method for enhancing the image quality of a reconstructed frame by using a transformer-based in-loop filter in a video encoding device or a video decoding device. A computing device is hereinafter referred to as a video encoding device or a video decoding device.
[0195] Fig. 20 is a flow chart of a method of enhancing image quality according to at least one embodiment of the present invention.
[0196] The computing device obtains an input region of a preset size from a reconstructed frame (S2000). Here, the reconstructed frame is a reconstructed frame of an original frame reconstructed in advance by the computing device.
[0197] The computing device feeds the input region into a deep learning-based in-loop filter to generate an enhanced video region that approximates the original frame (S2002).
[0198] Here, the in-loop filter includes K consecutive transformer blocks (where K is a natural number) and a second CNN.
[0199] The computing device may perform the step of generating an enhanced video region (step S2002 ) as follows.
[0200] Using the transformer block, the computing device converts the input image into final output features based on the attention operation (S2010).
[0201] The computing device partitions the input features of each transformer block into patches and applies an attention operation to each patch to generate an output feature of the input features of each transformer block. The computing device sets each patch as a query and calculates a self-attention score of each patch and an attention score between each patch and other patches based on the similarity between the two patches used in the attention operation. The computing device can then perform a weighted summation of the attention scores to generate an attention value for each patch.
[0202] The computing device inputs the final output features into the second CNN to generate an enhanced video region (S2012).
[0203] Fig.21 is a flow chart of a method for enhancing image quality according to another embodiment of the present invention.
[0204] The computing device obtains an input region of a preset size from the reconstructed frame (S2100). Here, the reconstructed frame is a reconstruction of an original frame reconstructed in advance by the computing device.
[0205] The computing device feeds the input region into a deep learning-based in-loop filter to generate an enhanced video region that approximates the original frame ( S2102 ).
[0206] Here, the in-loop filter includes a first CNN, K consecutive transformer blocks (where K is a natural number), and a second CNN.
[0207] The computing device may perform the step of generating an enhanced video region, namely step S2102, as follows.
[0208] The computing device inputs the input region into the first CNN to generate input features ( S2110 ).
[0209] The computing device uses a transformer block to convert the input features into final output features based on an attention operation (S2112).
[0210] The computing device inputs the final output features into the second CNN to generate an enhanced video region (S2114).
[0211] Although the steps in the various flowcharts are described as being performed sequentially, these steps merely illustrate the technical ideas of some embodiments of the present invention. Therefore, a person of ordinary skill in the art to which the present invention belongs can perform the steps by changing the order described in the various figures or by performing two or more steps in parallel. Therefore, the steps in the various flowcharts are not limited to the order shown in the order in which they occur.
[0212] It should be understood that the above description presents illustrative embodiments that can be implemented in various other ways. The functions described in some embodiments can be implemented by hardware, software, firmware and / or their combination. It should also be understood that the functional components described in the present invention are marked as "... units" to highlight the possibility of their independent implementation.
[0213] On the other hand, the various methods or functions described in some embodiments can be implemented as instructions stored in a non-volatile recording medium, which can be read and executed by one or more processors. Non-volatile recording media can include various types of recording devices that store data in a form that is readable by a computer system. For example, non-volatile recording media can include storage media, such as erasable programmable read-only memory (EPROM), flash drives, optical disk drives, magnetic hard drives, and solid-state drives (SSDs), etc.
[0214] Although exemplary embodiments of the present invention are described for illustrative purposes, it will be appreciated by those skilled in the art that various modifications, additions and substitutions may be made without departing from the spirit and scope of the present invention. Therefore, embodiments of the present invention are described for simplicity and clarity. The scope of the technical ideas of the embodiments of the present invention are not limited by the examples. Accordingly, it will be appreciated by those skilled in the art that the scope of the present invention should not be limited by the embodiments clearly described above, but by the claims and their equivalents.
[0215] Reference numerals
[0216] 180: Loop filter unit
[0217] 155: Entropy Encoder
[0218] 510: Entropy Decoder
[0219] 560: Loop filter unit.
[0220] CROSS-REFERENCE TO RELATED APPLICATIONS
[0221] This application claims priority to and the benefit of Korean Patent Application No. 10-2022-0022404, filed on February 21, 2022, and Korean Patent Application No. 10-2023-0007352, filed on January 18, 2023, the entire contents of each of which are incorporated herein by reference.
Claims
1. A method for enhancing the image quality of a reconstructed frame performed by a video decoding device, the method include: Obtaining an input region of a preset size from a reconstructed frame, wherein the reconstructed frame is a reconstruction of an original frame and has been reconstructed in advance by a video decoding device; as well as By feeding the input region into a deep learning based in-loop filter to generate an enhanced video region that approximates the original frame, Wherein, the in-loop filter includes K consecutive transformer blocks, and K is a natural number, Generating enhanced video regions involves transforming the input image into final output features based on an attention operation by utilizing K consecutive transformer blocks.
2. The method according to claim 1, in: The in-loop filter further includes a first convolutional neural network (CNN); as well as Generating the enhanced video region further includes: Generate input features by feeding the input region into the first CNN, and By utilizing K consecutive transformer blocks, the input features are transformed into the final output features based on the attention operation.
3. The method according to claim 2, in, The in-loop filter further includes a second CNN, and wherein generating the enhanced video region includes feeding the final output features into the second CNN to generate the enhanced video region.
4. The method according to claim 2, in, The conversion input features include: The input features of each transformer block are partitioned into patches, and an attention operation is applied to each patch to generate output features of the input features of each transformer block.
5. The method according to claim 4, in, The conversion input features include: Set each patch to query; Compute a self-attention score for each patch and an attention score between each patch and other patches based on the similarity between the two patches used in the attention operation; and The attention scores are weighted summed to generate an attention value for each patch.
6. The method according to claim 4, in, The conversion input features include: When the two patches used in the attention operation are unequal in size, padding is applied to equalize the two patches in size.
7. The method according to claim 5, in, The conversion input features include: When the two patches used in the attention operation do not appear together in the input features, no attention score is calculated.
8. The method according to claim 5, in, The conversion input features include: The attention score is not calculated when the two patches used in the attention operation exist in different data processing units, which are coding tree units (CTUs) or virtual pipeline data units (VPDUs).
9. The method according to claim 4, in, The input features include: When each patch falls outside the boundary of a preset data processing unit, not applying the attention operation to each patch; and When the partial region falls outside the boundary, no attention operation is applied to the partial region of each patch based on the mask indicating the partial region outside the boundary.
10. The method according to claim 4, in, The conversion input features include: When each patch exists in a later decoding order than the current block, no attention operation is applied to each patch; and When the partial region exists in a later order, the attention operation is not applied to the partial region of each patch based on a mask indicating the partial region of the later order.
11. The method according to claim 4, in, Each converter block consists of: Successive layers of transformers; and an optional convolutional layer, Therein, each of the consecutive transformer layers includes an encoder layer and a decoder layer.
12. The method according to claim 11, in, Each transformer block is formed as a residual block of consecutive transformer layers by utilizing skip connections.
13. A method for enhancing the image quality of a reconstructed frame performed by a video encoding device, the method include: Obtaining an input region of a preset size from a reconstructed frame, wherein the reconstructed frame is a reconstruction of an original frame and has been reconstructed in advance by a video encoding device; as well as By feeding the input region into a deep learning based in-loop filter to generate an enhanced video region that approximates the original frame, Wherein, the in-loop filter includes K consecutive transformer blocks, and K is a natural number, Generating enhanced video regions involves transforming the input image into final output features based on an attention operation by utilizing K consecutive transformer blocks.
14. The method according to claim 13, in: The in-loop filter further includes a first convolutional neural network (CNN); as well as Generating the enhanced video region further includes: Generate input features by feeding the input region into the first CNN, and By utilizing K consecutive transformer blocks, the input features are transformed into the final output features based on the attention operation.
15. The method according to claim 14, in: The in-loop filter further includes a second CNN; and Generating the enhanced video region includes feeding the final output features into a second CNN to generate the enhanced video region.
16. A computer-readable recording medium storing a bit stream generated by a video encoding method, the video encoding method include: obtaining an input region of a preset size from a reconstructed frame, the reconstructed frame being a reconstruction of an original frame and having been reconstructed in advance by a video encoding apparatus; as well as By feeding the input region into a deep learning based in-loop filter to generate an enhanced video region that approximates the original frame, Wherein, the in-loop filter includes K consecutive transformer blocks, and K is a natural number, Generating enhanced video regions involves transforming the input image into final output features based on an attention operation by utilizing K consecutive transformer blocks.
Citation Information
Cited By
Enhanced CT (Computed Tomography) image generation method and equipment based on double-space constraint
CN120876659A
