Hole filling method for virtual viewpoint composite image
By combining CNNs and Transformer architecture, using DCSW Transformer module and global-local fusion module, the problem of high computational cost of hole filling and insufficient visual coherence in virtual viewpoint synthesis is solved, and efficient and accurate hole filling effect is achieved, which is suitable for different applications. Virtual viewpoint synthesis scene.
Patent Information
- Application Number
- CN202410682107.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-29
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2044-05-29
AI Technical Summary
The existing Transformer model has high computational costs in virtual viewpoint synthesis, is highly dependent on a large amount of training data, and is difficult to effectively capture sufficient contextual information, resulting in poor hole filling effects, visual coherence, and insufficient content accuracy.
Combining convolutional neural networks (CNNs) and Transformer architecture, a hybrid network is designed, using the Extended Cross Stripe Window (DCSW) Transformer module and global-local fusion module to reduce computational costs and enhance the accuracy and naturalness of hole filling. And optimize image color stability through the Human Visual System (HVS) loss function.
It achieves efficient and accurate filling of holes in virtual viewpoint synthesis images, reduces the need for big data training, improves the accuracy and visual coherence of hole filling, and has broad applicability and significant practical value.
Smart Images

Figure CN118691507A
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of image processing technology, specifically the field of virtual viewpoint synthesis technology, and relates to a method for filling holes in a virtual viewpoint synthesis image, specifically a method for filling holes in a virtual viewpoint synthesis image combining a convolutional neural network and a Transformer architecture. Background Art
[0002] In computer vision tasks, although the Transformer model has demonstrated its powerful capabilities in many fields with its excellent performance, the existing Transformer models often have high computational costs due to the large number of parameters. More importantly, these models rely on a large amount of training data to achieve the best results, and in the scene of virtual viewpoint synthesis, the information of the reference viewpoint is often limited, which makes the application of the model in the hole filling task subject to substantial restrictions. In addition, the existing Transformer model is difficult to effectively capture enough contextual information to accurately fill the holes caused by virtual viewpoint synthesis, and thus performs poorly in visual coherence and content accuracy. Summary of the invention
[0003] The purpose of the present invention is to provide a method for filling holes in virtual viewpoint synthesis images, aiming to solve the problems of high computational cost, strong dependence on a large amount of training data, and insufficient visual coherence and content accuracy in the prior art. The present invention combines the global perception ability of the Transformer model and the local feature extraction advantages of convolutional neural networks (CNNs) to achieve efficient and accurate filling of holes in virtual viewpoint synthesis images. The core of the design is to improve the accuracy and naturalness of hole filling while reducing computational costs and alleviating the need for big data training, optimize the core problems of virtual viewpoint synthesis, and prove the superior performance and wide applicability of the model.
[0004] The present invention is specifically as follows:
[0005] Step (1) constructs a generator; the generator includes a downsampling layer, a DCSW Transformer layer, a feature aggregation residual layer, a global-local fusion module and an upsampling layer. DCSW is an extended cross-stripe window.
[0006] (1-1) The original hole image I in and its corresponding mask M in The merged images are then input into the four downsampling convolutional layers of the downsampling layer to obtain the downsampling feature map F1.
[0007] (1-2) The downsampled feature map F1 is operated through the DCSW Transformer layer and the feature aggregation residual layer respectively.
[0008] The DCSW Transformer layer consists of four DCSW Transformer blocks, each of which includes a strip window attention unit, a multi-scale dilation attention unit, and a self-attention unit; the downsampled feature map F1 passes through the DCSW Transformer layer to perform the following operations:
[0009] In the first DCSW Transformer block, the downsampled feature F1 is first processed by layer normalization (LN) and then distributed to two branches; the data flow of the first branch passes through a linear layer and enters the strip window attention unit to obtain the strip window attention feature F2; the strip window attention feature F2 is processed by layer normalization and multi-layer perceptron MLP, and then added to F2 through residual connection to obtain the residual compensated feature F3; the data flow in the second branch passes through the convolution layer, and then passes through the multi-scale dilated attention unit and the self-attention unit in turn to obtain the multi-scale feature F4; the output F3 and F4 are fused by addition operation, and after layer normalization, they are input into the multi-layer perceptron MLP to obtain the first-level fusion feature Will Send it to the next DCSW Transformer block, repeat the operation, and so on until the fourth DCSW Transformer block; the four DCSW Transformer blocks output the first-level fusion features respectively Secondary fusion features Three-level fusion features And four-level fusion features
[0010] The feature aggregation residual layer consists of four residual dense blocks RDB and a global average pooling layer; the downsampled feature map F1 performs the following operations through the feature aggregation residual layer:
[0011] In the first residual dense block RDB, the downsampled feature F1 first passes through the first convolution layer and the ReLU activation function, and the output first feature is passed to the second convolution layer and the ReLU activation function, and the second output feature is output. After the two output features are cascaded, they are passed to the third convolution layer and the ReLU activation function, and the third output feature is output. After the three output features are cascaded, they are passed to the fourth convolution layer and the ReLU activation function, and the fourth output feature is output; after the four output features are cascaded, they are compressed by a 1×1 convolution layer, and then added to the downsampled feature F1 through a residual connection to form a first-level output feature. The first-level output features Send it to the next residual dense block RDB, repeat the operation, and so on until the fourth residual dense block RDB. The four residual dense blocks RDB output the first-level output features respectively. Secondary output features Three-level output characteristics and four-level output characteristics The global average pooling layer receives the output of each residual dense block RDB and obtains the global average pooled feature F A , F A , After adding F1, the final output feature of the feature aggregation residual layer is obtained.
[0012] (1-3) In the global-local fusion module, the second-level fusion features and the secondary output features Perform pixel-by-pixel multiplication to obtain secondary multiplication features Four-level fusion features and four-level output characteristics Perform pixel-by-pixel multiplication to obtain four-level multiplication features Secondary multiplication feature Four-level multiplication feature And the feature aggregation residual layer finally outputs the feature Perform pixel-by-pixel addition to obtain the first added feature Secondary multiplication feature Four-level multiplication feature And four-level fusion features Perform pixel-by-pixel addition to obtain the second added feature Will and Concatenate by channel to get the output feature F of the global-local fusion module fusion .
[0013] (1-4) The upsampling layer includes four convolutional layers. fusion Perform four upsampling convolution operations to obtain the hole repaired image I out .
[0014] Step (2) constructs a discriminator; the discriminator adopts a block-based generative adversarial network PatchGAN, which includes 5 convolutional layers, each of which has a convolution kernel size of 4×4, a step size of 2, and a Leaky ReLU activation function with a slope k=0.2.
[0015] Step (3) Construct the total loss function in, represents the L1 loss function, is the marginal loss function, represents the perceptual loss function, represents the total loss function of HVS, represents the adversarial loss function, λ1, λ edge , perc , totalHVS and λ adv is the loss weight of the corresponding loss function.
[0016] (3-1) Image I after hole repair out Compared with the real image I gt The L1 distance between them is used as the reconstruction loss; ||·||1 indicates L1 distance.
[0017] (3-2) Marginal loss function n=1,…,N; where N represents I out and I gt The number of pixels in, ⊙ represents pixel-by-pixel multiplication, ||·|| 2 represents the matrix square operation; edge mask M edge =(1-I edge )+10×I edge , I edge is the edge image obtained by applying the Canny edge detection algorithm.
[0018] (3-3) The perceptual loss function is used to improve the accuracy of perceptual reconstruction. out and I gt Send it to the VGG-19 model and get five activation maps; perceptual loss function Among them, φ k (I out ) indicates I out As the input activation map, φ k (I gt ) indicates I gt As the input activation map, k=1,2,3,4,5 is the activation map sequence number; Express expectations.
[0019] (3-4) HVS total loss function in:
[0020] HVS loss function
[0021] Marginal HVS loss function
[0022] HVS out This is the visual system diagram after hole repair, HVS gt is the real image visual system diagram, λ HVS and λ HVSedge is the loss weight of the corresponding loss function.
[0023] (3-5) Adversarial Loss Function in:
[0024] Generator loss function D(·) represents the discriminator output;
[0025] Discriminator loss function
[0026] Gradient Penalty Represents the gradient and sets the gradient penalty weight λ GP =1×10 -3 .
[0027] Step (4) trains the generator and discriminator to cooperate with the generator network to reconstruct the content and texture of the hole area.
[0028] Step (5) uses the trained generator to fill the holes in the original image.
[0029] The method of the present invention combines the local feature extraction capability of CNNs and the global context understanding capability of the Transformer architecture, and proposes an efficient hybrid network architecture. The core innovations include designing a lightweight network to reduce computing resource requirements, integrating the advantages of Transformer and CNNs to enhance the accuracy and visual coherence of hole filling, introducing the extended cross-stripe window (DCSW) Transformer module to improve the efficiency of spatial feature extraction, and using a residual layer based on global feature aggregation to enhance the information flow and integration between features. In addition, the present invention also uses the human visual system (HVS) loss function to optimize image color stability, and uses adversarial learning to further enhance the realism of the image. Through the enhancement of multi-scale and multi-view processing capabilities, the model of the present invention has excellent generalization and applicability. After a series of experimental verifications, the efficiency and superior performance of the present invention in the task of virtual viewpoint hole filling can be widely used in different virtual viewpoint synthesis scenarios, and has significant practical value and promotion potential. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 It is a simplified flow chart of the present invention. DETAILED DESCRIPTION
[0031] A hole filling method for virtual viewpoint synthesis images, such as Figure 1 As shown:
[0032] Step (1) constructs a generator; the generator includes a downsampling layer, a DCSW Transformer layer, a feature aggregation residual layer, a global-local fusion module and an upsampling layer.
[0033] (1-1) The original hole image I in and its corresponding mask M in The merged images are then input into the four downsampling convolutional layers of the downsampling layer to obtain the downsampling feature map F1.
[0034] (1-2) The downsampled feature map F1 is operated through the DCSW Transformer layer and the feature aggregation residual layer respectively.
[0035] The DCSW Transformer layer consists of four DCSW Transformer blocks, each of which includes a strip window attention unit, a multi-scale dilation attention unit, and a self-attention unit, which is designed to process global information and enhance spatial feature extraction capabilities. The downsampled feature map F1 is passed through the DCSW Transformer layer to perform the following operations:
[0036] In the first DCSW Transformer block, the downsampled feature F1 is first processed by layer normalization (LN) and then distributed to two branches. The data flow of the first branch passes through a linear layer and enters the strip window attention unit to obtain the strip window attention feature F2. The strip window attention unit is used to process the features inside the strip area to enhance the model's understanding and continuity of the local area of the image; after the strip window attention feature F2 is processed by layer normalization and multi-layer perceptron MLP, it is added to F2 through residual connection to obtain the residual compensated feature F3. After the data flow in the second branch passes through the convolutional layer, it passes through the multi-scale dilated attention unit and the self-attention unit in turn to obtain the multi-scale feature F4. This allows the model to extract spatial features at different scales and integrate this information through the self-attention mechanism to capture the global context of the scene. The design of the two branches provides a keen insight into local details and a broad understanding of global structure, which together promotes in-depth analysis of complex data. The output F3 and F4 are fused by addition operation, and after layer normalization, they are input into the multi-layer perceptron MLP to obtain the first-level fusion feature. Will Send it to the next DCSW Transformer block, repeat the operation, and so on until the fourth DCSW Transformer block. The four DCSW Transformer blocks output the first-level fusion features respectively. Secondary fusion features Three-level fusion features And four-level fusion features
[0037] The feature aggregation residual layer consists of four residual dense blocks RDB and a global average pooling layer. The downsampled feature map F1 passes through the feature aggregation residual layer and performs the following operations:
[0038] In the first residual dense block RDB, the downsampled feature F1 first passes through the first convolution layer and the ReLU activation function, and the output first feature is passed to the second convolution layer and the ReLU activation function, and the second output feature is output. After the two output features are cascaded, they are passed to the third convolution layer and the ReLU activation function, and the third output feature is output. After the three output features are cascaded, they are passed to the fourth convolution layer and the ReLU activation function, and the fourth output feature is output; after the four output features are cascaded, they are compressed by a 1×1 convolution layer, and then added to the downsampled feature F1 through a residual connection to form a first-level output feature. The first-level output features Send it to the next residual dense block RDB, repeat the operation, and so on until the fourth residual dense block RDB. The four residual dense blocks RDB output the first-level output features respectively. Secondary output features Three-level output characteristics and four-level output characteristics The global average pooling layer receives the output of each residual dense block RDB and obtains the global average pooled feature F A , F A , After adding F1, the final output feature of the feature aggregation residual layer is obtained.
[0039] (1-3) In the global-local fusion module, the second-level fusion features and the secondary output features Perform pixel-by-pixel multiplication to obtain secondary multiplication features Four-level fusion features and four-level output characteristics Perform pixel-by-pixel multiplication to obtain four-level multiplication features Secondary multiplication feature Four-level multiplication feature And the feature aggregation residual layer finally outputs the feature Perform pixel-by-pixel addition to obtain the first added feature Secondary multiplication feature Four-level multiplication feature And four-level fusion features Perform pixel-by-pixel addition to obtain the second added feature Will and Concatenate by channel to get the output feature F of the global-local fusion module fusion .
[0040] (1-4) The upsampling layer includes four convolutional layers. fusion Perform four upsampling convolution operations to obtain the hole repaired image I out .
[0041] Step (2) constructs a discriminator; the discriminator adopts a block-based generative adversarial network PatchGAN, which includes 5 convolutional layers, each of which has a convolution kernel size of 4×4, a step size of 2, and a Leaky ReLU activation function with a slope k=0.2.
[0042] Step (3) Construct the total loss function in, represents the L1 loss function, is the marginal loss function, represents the perceptual loss function, represents the total loss function of HVS, represents the adversarial loss function, λ1, λ edge , perc , totalHVS and λ adv is the loss weight corresponding to the loss function, which is set in this embodiment as: λ1=10, λ edge =10,λ perc =0.1,λ totalHVS =1,λ adv =10.
[0043] (3-1) Image I after hole repair out Compared with the real image I gt The L1 distance between them is used as the reconstruction loss to ensure the reconstruction accuracy based on pixel level; ||·||1 indicates L1 distance.
[0044] (3-2) Marginal loss function n=1,…,N; where N represents I out and I gt The number of pixels in, ⊙ represents pixel-by-pixel multiplication, ||·|| 2 Represents the matrix square operation. Edge mask M edge =(1-I edge )+10×I edge , to enhance the edge information in the process of hole filling, I edge is the edge image obtained by applying the Canny edge detection algorithm.
[0045] (3-3) The perceptual loss function is used to improve the accuracy of perceptual reconstruction. out and I gt Send it to the VGG-19 model and get five activation maps; perceptual loss function Among them, φ k (I out ) indicates I out As the input activation map, φ k (I gt ) indicates I gt As the input activation map, k=1,2,3,4,5 is the activation map sequence number; Express expectations.
[0046] (3-4) HVS total loss function in:
[0047] HVS loss function
[0048] Marginal HVS loss function
[0049] HVS out This is the visual system diagram after hole repair, HVS gt For the real image visual system diagram, the edge HSV loss is introduced, which can focus on the edge details of the hole-filled area and capture and enhance the color consistency of these key areas. HVS and λ HVSedge is the loss weight of the corresponding loss function. In this embodiment, λ HVS =10,λ HVSedge =100.
[0050] (3-5) Adversarial Loss Function in:
[0051] Generator loss function D(·) represents the discriminator output;
[0052] Discriminator loss function
[0053] Gradient Penalty Represents the gradient and sets the gradient penalty weight λ GP =1×10 -3 This strategy aims to control the gradient changes in the generation process by adjusting the loss function, thereby enhancing the stability of the model and the quality of the output image.
[0054] Step (4) trains the generator and discriminator to cooperate with the generator network to reconstruct the content and texture of the hole area.
[0055] Step (5) uses the trained generator to fill the holes in the original image.
Claims
1. A method for filling holes in a virtual viewpoint synthesis image, characterized in that: Step (1) constructing a generator; the generator includes a downsampling layer, a DCSW Transformer layer, a feature aggregation residual layer, a global-local fusion module and an upsampling layer; (1-1) The original hole image I in and its corresponding mask M in Merge and then input into the four downsampling convolutional layers of the downsampling layer to obtain the downsampling feature map F1; (1-2) The downsampled feature map F1 is passed through the DCSW Transformer layer and the feature aggregation residual layer, respectively; The DCSW Transformer layer consists of four DCSW Transformer blocks, each of which includes a strip window attention unit, a multi-scale dilation attention unit, and a self-attention unit; the downsampled feature map F1 passes through the DCSW Transformer layer to perform the following operations: In the first DCSW Transformer block, the downsampled feature F1 is first processed by layer normalization and then distributed to two branches; the data flow of the first branch passes through a linear layer and enters the strip window attention unit to obtain the strip window attention feature F2; the strip window attention feature F2 is processed by layer normalization and multi-layer perceptron MLP, and then added to F2 through residual connection to obtain the residual compensated feature F3; the data flow in the second branch passes through the convolution layer, and then passes through the multi-scale dilated attention unit and the self-attention unit in turn to obtain the multi-scale feature F4; the output F3 and F4 are fused by addition operation, and after layer normalization, they are input into the multi-layer perceptron MLP to obtain the first-level fusion feature Will Send it to the next DCSW Transformer block, repeat the operation, and so on until the fourth DCSW Transformer block; the four DCSW Transformer blocks output the first-level fusion features respectively Secondary fusion features Three-level fusion features And four-level fusion features The feature aggregation residual layer consists of four residual dense blocks RDB and a global average pooling layer; the downsampled feature map F1 performs the following operations through the feature aggregation residual layer: In the first residual dense block RDB, the downsampled feature F1 first passes through the first convolution layer and the ReLU activation function, and the output first feature is passed to the second convolution layer and the ReLU activation function, and the second output feature is output. After the two output features are cascaded, they are passed to the third convolution layer and the ReLU activation function, and the third output feature is output. After the three output features are cascaded, they are passed to the fourth convolution layer and the ReLU activation function, and the fourth output feature is output. The four output features are cascaded and then compressed through a 1×1 convolution layer. They are then added to the downsampled feature F1 through a residual connection to form a first-level output feature. The first-level output features Send it to the next residual dense block RDB, repeat the operation, and so on until the fourth residual dense block RDB. The four residual dense blocks RDB output the first-level output features respectively. Secondary output features Three-level output characteristics and four-level output characteristics The global average pooling layer receives the output of each residual dense block RDB and obtains the global average pooled feature F A , F A , After adding F1, the final output feature of the feature aggregation residual layer is obtained. (1-3) In the global-local fusion module, the second-level fusion features and the secondary output features Perform pixel-by-pixel multiplication to obtain secondary multiplication features Four-level fusion features and four-level output characteristics Perform pixel-by-pixel multiplication to obtain four-level multiplication features Secondary multiplication feature Four-level multiplication feature And the feature aggregation residual layer finally outputs the feature Perform pixel-by-pixel addition to obtain the first added feature Secondary multiplication feature Four-level multiplication feature And four-level fusion features Perform pixel-by-pixel addition to obtain the second added feature Will and Concatenate by channel to get the output feature F of the global-local fusion module fusion ; (1-4) The upsampling layer includes four convolutional layers. fusion Perform four upsampling convolution operations to obtain the hole repaired image I out ; Step (2) constructing a discriminator; the discriminator adopts a block-based generative adversarial network PatchGAN, which includes 5 convolutional layers, each of which has a convolution kernel size of 4×4, a step size of 2, a Leaky ReLU activation function, and a slope k=0.2; Step (3) Construct the total loss function in, represents the L1 loss function, is the marginal loss function, represents the perceptual loss function, represents the total loss function of HVS, represents the adversarial loss function, λ1, λ edge , perc , totalHVS and λ adv is the loss weight of the corresponding loss function; (3-1) Image I after hole repair out Compared with the real image I gt The L1 distance between them is used as the reconstruction loss; ||·||1 indicates L1 distance; (3-2) Marginal loss function Where N represents I out and I gt The number of pixels in, ⊙ represents pixel-by-pixel multiplication, ||·|| 2 represents the matrix square operation; edge mask M edge =(1-I edge )+10′I edge , I edge is the edge image obtained by applying the Canny edge detection algorithm; (3-3) The perceptual loss function is used to improve the accuracy of perceptual reconstruction. out and I gt Send it to the VGG-19 model and get five activation maps; perceptual loss function Among them, φ k (I out ) indicates I out As the input activation map, φ k (I gt ) indicates I gt As the input activation map, k=1,2,3,4,5 is the activation map sequence number; express expectations; (3-4) HVS total loss function in: HVS loss function Marginal HVS loss function HVS out This is the visual system diagram after hole repair, HVS gt is the real image visual system diagram, λ HVS and λ HVSedge is the loss weight of the corresponding loss function; (3-5) Adversarial Loss Function in: Generator loss function D(×) represents the discriminator output result; Discriminator loss function Gradient Penalty Represents the gradient and sets the gradient penalty weight λ GP =1′10 -3 ; Step (4) training the generator and the discriminator to cooperate with the generator network to reconstruct the content and texture of the hole area; Step (5) uses the trained generator to fill the holes in the original image.
Citation Information
Patent Citations
Brain tumor segmentation data enhancement method based on generative adversarial network
CN111833359A
Global and local multi-scale dynamic virtual viewpoint hole filling method
CN117372461A
Focusing-learning-based CT angiography smart imaging method
WO2024066711A1
