Normalization panoramic image restoration method based on kernel transformation and mask guidance
Through kernel transformation and mask-guided normalization technology, the challenges caused by distortion and high resolution in panoramic image restoration are solved, more effective feature extraction and restoration effects are achieved, and the robustness and vision of panoramic image restoration are improved. Effect.
Patent Information
- Application Number
- CN202410816334.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-24
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2044-06-24
AI Technical Summary
It is difficult to effectively repair panoramic images with existing technologies, especially due to their high resolution and distortion characteristics, which lead to poor repair effects, artifacts, and blur, and it is difficult to control the generated content, leading to repair failure.
A panoramic image repair method based on kernel transformation and mask-guided normalization is adopted. By overlaying the panoramic image and the mask map, mapping it to the UV plane, using the kernel transformation module to extract features, and combining the multi-head self-attention mechanism and position coding to learn long-range features, and optimize the normalization process through mask-guided normalization, and train the model using a targeted loss function.
It achieves more reasonable repair results, improves the robustness of the model, can better handle the distortion and missing data of panoramic images, and improves the controllability and visual compliance of the repair effect.
Smart Images

Figure CN118570107A
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of panoramic image restoration, and in particular relates to a panoramic image restoration method based on kernel transformation and mask-guided normalization. Background Art
[0002] With the continuous development of video technology, the transmission and display technology of digital images and videos has made rapid progress. People are no longer satisfied with the simple needs of hearing and vision for information products, but hope to have an immersive feeling and experience. Panoramic images and videos have therefore been widely used. However, like flat images, panoramic images are also subject to damage, defects and distortion. How to repair panoramic images to a satisfactory level is an important research method. The current restoration technology applied to flat images is difficult to complete the restoration of panoramic images.
[0003] At present, image restoration technology mainly uses methods based on generative adversarial networks. By learning a large amount of image feature information, images that meet visual features are obtained in iterative training of generators and discriminators. This method has achieved good results in planar images. However, this method is difficult to control the content of the generated image, and it is prone to restoration failure. In addition, it is mainly applied to planar images, while panoramic images have higher resolution and more distortion than planar images. If it is directly applied to panoramic images, it is easy to have poor image restoration effects, restoration results containing a large number of artifacts and blurs, or even restoration failures, and it is difficult to deal with the distortion problem in panoramic images. Summary of the invention
[0004] In order to solve the shortcomings of the prior art, avoid large-scale distortion of panoramic images, make the generated content more controllable, and make the restoration results more in line with the visual effect, the present invention adopts the following technical solutions:
[0005] A panoramic image restoration method based on kernel transformation and mask-guided normalization includes the following steps:
[0006] Step 1: Superimpose the panoramic image and the mask image accordingly to obtain a pair of panoramic images to be repaired, and map them to the UV plane respectively;
[0007] Step 2: divide the mapped image into grids, and use the obtained regular grids as the receptive field input convolution kernel for feature extraction;
[0008] Step 3: Perform RoI pooling operation on the extracted features, optimize the grid position offset, and obtain the RoI feature map;
[0009] Step 4: Use a multi-head self-attention mechanism on the RoI feature map to learn the long-range feature information in the panoramic image. Use a fully connected self-attention module and position encoding to learn the long-range feature information in the panoramic image. Most GAN-based image generation models are built using convolutional layers, which process information in a local neighborhood. Therefore, using convolutional layers alone is computationally inefficient for long-range dependencies between images.
[0010] Step 5, superimposing the output of the pair of panoramic images to be repaired in step 4, inputting them into the neural network for transmission, first performing batch normalization in the shallow layer of the neural network, and using layer normalization in the deep layer of the neural network, normalizing the region by combining the features of the occluded region through the mask-guided normalization operation, and applying the mask to the calculation process of each sample when calculating the normalized statistic to exclude the influence of the invalid region, so as to obtain the feature map after mask-guided normalization; compared with simply using batch normalization or layer normalization, using mask-guided normalization has better flexibility, can adaptively adjust the normalization process, flexibly indicate which samples or features should participate in the normalization process, and at the same time, for the case where the input data is missing, mask-guided normalization can better handle the case of missing data by ignoring the calculation of missing values or treating them as invalid samples, which helps to improve the robustness of the model in the presence of missing values;
[0011] Step six, since the kernel transformation module is used in the above steps, which is a method similar to the dynamic transformation of the convolution kernel, it has outstanding performance in dealing with the distortion and stretching of the panoramic image. At the same time, it will also bring about the expansion of the receptive field. For the large receptive field, the repaired panoramic image is obtained based on the mask-guided normalized feature map. The repaired panoramic image is used as the predicted image and compared with the real image. The panoramic image repair process is trained through the targeted modified loss function.
[0012] Furthermore, the step 1 comprises the following steps:
[0013] Step 1.1: Superimpose the panoramic image x and the mask image to obtain the panoramic image x to be repaired. ′ , the panoramic image and the mask image are randomly rotated by a certain angle and then superimposed to obtain the panoramic image to be repaired
[0014] Step 1.2, the point coordinates on the UV plane correspond to the coordinates of the spherical pixel points on the panoramic image to be repaired:
[0015]
[0016] Among them, θ m,n Represents the pixel point P on the UV plane m,nThe azimuth angle mapped to the spherical image, Φ m,n Represents the pixel point P on the UV plane m,n The pitch angle, θ, mapped to the spherical image m,n , Φ m,n Commonly expressed P m,n Mapped to the pixel coordinates on the spherical image, P m,n Represents a pixel point on the UV plane, m and n represent the width and height coordinates on the UV plane, and W and H represent the width and height of the UV plane respectively.
[0017] Furthermore, the step 2 comprises the following steps:
[0018] Step 2.1, input the mapped image into the kernel transformation module, take a pixel point on the sphere as the entry point, take a circle of pixel points on the sphere around the tangent point, and approximate the tangent plane on the sphere due to the principle of differentiation. The tangent plane is divided into a regular grid G, and the tangent point is used as the origin of the grid to determine the coordinates of each part of the grid G. The offset of the regular grid G is {△P n |n=1,…,N},N=|G|, N means dividing the regular grid G into N small grids, |G| means the division process is carried out in the entire regular grid G and will not exceed the scope of the regular grid G. The entire grid G is input into the convolution kernel as the receptive field, the regular grid G is sampled, and the weighted sampling values are summed according to w. For any tangent point P i , the output feature map F(P i );
[0019] Step 2.2, in order to achieve accurate sampling, the present invention uses a bilinear interpolation method to process the specific sampling position, F(P i ) is decomposed into two dimensions, and D h and D v Two 1D kernels.
[0020] Since panoramic images have the characteristics of high pixel values and a large number of distortions, the image feature information extracted using ordinary convolution operations is very limited, making it difficult to complete the feature extraction task of the panoramic image, and thus difficult to achieve subsequent restoration tasks. The present invention replaces ordinary convolution with a kernel transformation module, which can better adapt to the characteristics of panoramic images with a large number of distortions, making the restoration results more reasonable and more robust.
[0021] Furthermore, the feature map F(P i )for:
[0022]
[0023] Among them, x(·) represents the area to be extracted, w(P i) represents the tangent point P i The weighting parameter, P n represents a discrete integer position, and ΔP n is relative to P n The decimal offset, where the offset △P n Usually a small value, indicating relative to P n of small displacement.
[0024] Furthermore, in step 2.2, the two one-dimensional kernels are as follows:
[0025]
[0026] g(a,b)=max(0,1-|ab|)
[0027] Among them, k represents an arbitrary fractional position, which is composed of P0, P n and △P n Composition, where P0 represents the initial position, P n represents a discrete integer position, and ΔP n is relative to P n The fractional offset of , in the horizontal direction, through the one-dimensional kernel D h Consider the horizontal position k h and the horizontal fractional offset p h The impact on the interpolation result, in the vertical direction, is through the one-dimensional kernel D v Consider the vertical position k v and the vertical fractional offset p v The impact on the interpolation result, g(a,b) represents the corresponding maximum value operation based on parameters a and b, a and b represent k h and p h , or k v and p v The extracted feature information of different dimensions is used as the input of step three.
[0028] Furthermore, in the step 3, RoI pooling is configured in conjunction with kernel transformation to divide the H*W grid into h*w RoI sub-windows, and then the value of each sub-window is pooled to the corresponding output grid unit, wherein RoI pooling is divided into two branches, upper and lower; in the upper branch, the feature map is input into the RoI pooling layer after a 3*3 convolution operation, and RoI pooling is applied separately to the channel of each feature map to obtain the normalized offset In the lower branch, the feature map is convolved with the output of the upper branch after a 3*3 convolution operation. Perform a channel-by-channel multiplication operation to obtain the actual offset △P i,j , and finally output the RoI feature map after 3*3 deconvolution operation.
[0029] Furthermore, in step 4, the image feature information is first transformed into two feature spaces f and g with the same structure, which is convenient for subsequent transposition and product operations, and the attention is calculated channel by channel for each space:
[0030] f(x)=W f x,g(x)=W g x
[0031]
[0032] Among them, x i represents the i-th region of the feature space, x j represents the jth region of the feature space, t ij represents the transpose of region i in feature space f multiplied by region j in feature space g, F j,i represents the degree to which the multi-head self-attention module pays attention to the i-th region when synthesizing the j-th region, C represents the number of channels, L represents the number of feature positions of the previous hidden layer feature, and the output of the attention layer is o = {o1, o2, ..., o j ,…,o L}∈R C*L ,in:
[0033]
[0034] h(x i )=W h x i
[0035] Among them, h(x i ) represents the multiplication of region i in the feature space by W h The result of the parameter, vF j,i h(x i ) / represents the multiplication of region i in the feature space by W v The result of the parameter, W g ∈R C*C , W f ∈R C*C , W h ∈R C*C , W v ∈R C*C They are all learned weight matrices, they are implemented as 1*1 convolutions, and the final output results are used as the input for the next step of mask-guided normalization.
[0036] Furthermore, in the step 5, the outputs of the panoramic images to be restored in step 4 are respectively used as input feature maps F in and the mask feature map F m , that is, the panoramic image x to be restored ′ After step 4, the input feature map F is outputin , the panoramic image to be restored After step 4, the mask feature map F is output m , the mask feature map F m Superimposed on the input feature map F in The selective feature map F is obtained ′ ; The value of the blocked area in the mask is 0, which is obtained by the following formula:
[0037] F ′ =F in *F m
[0038] Selective feature map F ′ When passing through the neural network, batch normalization is performed in the shallow layer of the network. Each feature dimension is normalized in each batch. The input data is normalized by subtracting the mean and dividing by the standard deviation to obtain F ′ BN Before entering the next stage, the feature vector is normalized based on the pixel area. The deleted area of the feature map must be restored. In the deep layer of the neural network, layer normalization is used for the network layer output. It does not rely on the statistical information within the batch, but uses the statistical information of each sample on a specific layer for normalization. It can make the network more stable for the input of each sample and help to deal with small batches or single samples. The mask is applied to the calculation process of each sample to exclude the influence of the invalid area. The mask obtained by the two-stage operation guides the normalized feature map F MN as follows:
[0039]
[0040]
[0041] in, Represent the feature map F ′ 、F m The pixel value at (n,c,i,j), n represents the nth grid divided regularly, c represents the cth spatial channel, i and j represent the length and width coordinates of the pixel value, represents the intermediate result of batch normalization output, represents the intermediate result of the normalized output of the layer, γ BN and γ LN represents the scale parameter, β BN and β LN represents the translation parameter, and Represents the weight parameter to be learned, ∈ is used to avoid the denominator being 0, μ BN , μ LN and The definition is as follows:
[0042]
[0043] Among them, R u Represents the area not blocked by the mask, which is expressed by the following formula:
[0044]
[0045] Furthermore, in step 6, training is performed using loss functions, including a high receptive field perception loss function, an adversarial loss function, and an L1 loss function;
[0046] High receptive field perceptual loss, through pre-trained network Evaluate the feature distance between the predicted image and the real image, which is used to compare the similarity of the high-level feature structure between the predicted image and the real image, and is defined as follows:
[0047]
[0048] in, Represents the characteristic information of the real image, Represents the predicted image feature information, img represents the real image, Represents the predicted image, and N represents the number of image features;
[0049] The adversarial loss is defined as follows:
[0050]
[0051] Among them, E img [] represents the expected function of the image, E img,m [] represents the expected function of the image mask, ⊙ represents element-by-element multiplication, D() represents the variance function of the image, and m represents the mask;
[0052] The L1 loss is defined as follows:
[0053]
[0054] The overall loss function is defined as follows:
[0055] L total =L1+λ p L p +λ adv L adv
[0056] Among them, λ p The coefficient representing the high receptive field perceptual loss, λ adv Represents the coefficient of adversarial loss.
[0057] The advantages and beneficial effects of the present invention are:
[0058] The present invention discloses a panoramic image restoration method based on kernel transformation and mask-guided normalization. By replacing ordinary convolution with kernel transformation module, the method can better adapt to the characteristics of panoramic images with a large number of distortions, so that the restoration results are more reasonable and more robust. The long-range feature information in the panoramic image is learned by using a fully connected self-attention module and position encoding. The normalization process is adaptively adjusted through mask-guided normalization to flexibly indicate which samples or features should participate in the normalization process. At the same time, for the case where the input data is missing, the mask-guided normalization can ignore the calculation of the missing value or regard it as an invalid sample, so as to better handle the case of missing data, which helps to improve the robustness of the model in the presence of missing values. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] Figure 1 is a flow chart of a method in an embodiment of the present invention.
[0060] Figure 2 is an architecture diagram of a panoramic image restoration network in an embodiment of the present invention.
[0061] Figure 3 Schematic diagram of RoI pooling operation in an embodiment of the present invention.
[0062] Figure 4 In the embodiment of the present invention, Figure 3 Schematic diagram of the normalized offset prediction in the upper branch.
[0063] Figure 5 Schematic diagram of mask-guided normalization in an embodiment of the present invention. DETAILED DESCRIPTION
[0064] The specific implementation of the present invention is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described here is only used to illustrate and explain the present invention, and is not used to limit the present invention.
[0065] like Figure 1 , Figure 2 As shown, a panoramic image restoration method based on kernel transformation and mask-guided normalization includes the following steps:
[0066] Step 1: Preprocessing before inputting the panoramic image restoration network.
[0067] Step 1.1: The main body of the network is based on the twin network architecture. Two rotated panoramic images are required as input. The input panoramic image x and the mask image m are superimposed to obtain the panoramic image x to be repaired. ′ , the panoramic image x and the mask image m are randomly rotated by a certain angle and then superimposed to obtain the panoramic image to be repaired Figure 2The upper branch in is the panoramic image x to be restored. ′ , the lower branch is the panoramic image to be restored
[0068] Step 1.2: In order to facilitate the subsequent processing of image information in the network, we need to convert the panoramic image x ′ and Mapped to the UV plane, the UV plane can be regarded as a planar representation of the unfolded spherical image. It is represented by a square area, usually ranging from (0,0) to (1,1). The coordinates of each point on the UV plane correspond to a pixel on the spherical image. Let there be a pixel on the UV plane as P m,n , m, n represent the horizontal and vertical coordinates on the UV plane. By defining the texture coordinates on the UV plane, we can map the texture to the corresponding position of the spherical image. W, H represent the width and height of the UV plane respectively, S represents the sphere, and for each pixel point P mapped to the spherical image m,n ,S(θ m,n ) and S(Φ m,n ) together represent the pixel point P m,n The coordinate set on the sphere after mapping is represented.
[0069]
[0070] Among them, θ m,n Represents the pixel point P on the UV plane m,n The azimuth angle mapped to the spherical image, Φ m,n Represents the pixel point P on the UV plane m,n The pitch angle, θ, mapped to the spherical image m,n , Φ m,n Commonly expressed P m,n Mapped to pixel coordinates on a spherical image.
[0071] After the above operations, each pixel in the original panoramic image can be mapped to the UV plane, and then the two panoramic images can be input into the network.
[0072] Step 2: Next, it is necessary to extract feature information from the two input panoramic images, input the mapped images into the kernel transformation module, and extract feature information from the panoramic images through the kernel transformation module; that is, Figure 2 The input of the upper and lower branches is x ′ and The respective S(θ m,n )、S(Φ m,n ).
[0073] Step 2.1, in the kernel transformation module, a pixel point on the sphere is taken as the entry point, and a circle of pixel points on the sphere around the tangent point is taken. Due to the principle of differential, it can be approximately regarded as a tangent plane on the sphere. The tangent plane is divided into a regular grid G, and the tangent point is used as the origin of the grid to determine the coordinates of each part of the grid G. The offset of the regular grid G is {△P n |n=1,…,N},N=|G|, N means dividing the regular grid G into N small grids, |G| means the division process is carried out in the entire regular grid G and will not exceed the scope of the regular grid G. The entire grid G is input into the convolution kernel as the receptive field, the regular grid G is sampled, and the weighted sampling values are summed according to w. For any tangent point P i , the output feature map is:
[0074]
[0075] Among them, x(·) represents the area to be extracted, w(P i ) represents the tangent point P i The weighting parameter, P n represents a discrete integer position, and ΔP n is relative to P n The decimal offset, where the offset △P n Usually a small value, indicating relative to P n of small displacement.
[0076] Step 2.2, in order to achieve accurate sampling, the present invention uses a bilinear interpolation method to process the specific sampling position, F(P i ) is decomposed into two dimensions, namely D h and D v Two 1D kernels:
[0077]
[0078] g(a,b)=max(0,1-|ab|)
[0079] Among them, k represents an arbitrary fractional position, which is composed of P0, P n and △P n Composition, where P0 represents the initial position, P n represents a discrete integer position, and ΔP n is relative to P n The fractional offset of the horizontal kernel D h Considering the horizontal position k h and the horizontal fractional offset p h The impact on the interpolation result is the same in the vertical direction. The one-dimensional kernel D vConsidering the vertical position k v and the vertical fractional offset p v The impact on the interpolation result, g(a,b) represents the corresponding maximum value operation based on parameters a and b, a and b represent k h and p h , or k v and p v The extracted feature information of different dimensions is used as the input of step three.
[0080] Since panoramic images have the characteristics of high pixel values and a large number of distortions, the image feature information extracted using ordinary convolution operations is very limited, making it difficult to complete the feature extraction task of the panoramic image, and thus difficult to achieve subsequent restoration tasks. The present invention replaces ordinary convolution with a kernel transformation module, which can better adapt to the characteristics of panoramic images with a large number of distortions, making the restoration results more reasonable and more robust.
[0081] Step 3: The RoI pooling module is used in conjunction with the kernel transformation module to input the extracted feature information into the ROI pooling module.
[0082] RoI pooling divides the H*W grid into h*w RoI sub-windows, and then pools the value of each sub-window into the corresponding output grid unit. Different from the general pooling method, the RoI designed in the present invention is divided into two branches, upper and lower. Figure 3 As shown in the figure, in the upper branch, the feature map is input into the RoI pooling layer after the 3*3 convolution operation. RoI pooling is applied separately to the channel of each feature map to obtain the normalized offset In the lower branch of the figure, the feature map also undergoes a 3*3 convolution operation. The difference is that after the convolution operation, a channel-by-channel multiplication operation is performed with the output of the upper branch to obtain the actual offset △P i,j , and then output the RoI feature map after a 3*3 deconvolution operation. Figure 4 Yes Figure 3 Further illustration of the 3*3 convolution operation and RoI pooling operation.
[0083] Step 4: Input the RoI feature map output in the previous step into the multi-head self-attention module, and use the fully connected self-attention module and position encoding to learn the long-range feature information in the panoramic image. Most GAN-based image generation models are built using convolutional layers, which process information in a local neighborhood. Therefore, using convolutional layers alone is computationally inefficient for long-range dependencies between images.
[0084] The image feature information from the previous hidden layer is first transformed into two feature spaces f and g with the same structure to facilitate the subsequent transposition and product operations, and the attention is calculated channel by channel for each space:
[0085] f(x)=W f x,g(x)=W g x
[0086]
[0087] Among them, x i represents the i-th region of the feature space, x j represents the jth region of the feature space, t ij represents the transpose of region i in feature space f multiplied by region j in feature space g, F j,i represents the degree to which the multi-head self-attention module pays attention to the i-th region when synthesizing the j-th region, C represents the number of channels, L represents the number of feature positions of the previous hidden layer feature, and the output of the attention layer is o = {o1, o2, ..., o j ,…,o L}∈R C*L ,in:
[0088]
[0089] h(x i )=W h x i
[0090] Among them, h(x i ) represents the multiplication of region i in the feature space by W h The result of the parameter, vF j,i h(x i ) / represents the multiplication of region i in the feature space by W v The result of the parameter, W g ∈R C*C , W f ∈R C*C , W h ∈R C*C , W v ∈R C*C They are all learned weight matrices, they are implemented as 1*1 convolutions, and the final output results are used as the input for the next step of mask-guided normalization.
[0091] Step 5: Guide the normalization operation through the mask, normalize the area based on the features of the occluded area, and apply the mask to the calculation process of each sample when calculating the normalized statistics to exclude the influence of the invalid area.
[0092] like Figure 5 As shown, the input feature map is represented as F in ,correspond Figure 2 The output of the multi-head self-attention module in the upper branch represents the feature map corresponding to the mask as F m ,correspond Figure 2 The output of the multi-head self-attention module in the lower branch is superimposed on the input feature map through the mask feature map to obtain the selective feature map F ′ , the value of the blocked area in the mask is 0, which is obtained by the following formula:
[0093] F ′ =F in *F m
[0094] Selective feature map F ′ Passing through the neural network, batch normalization is first performed in the shallow layer of the network. Each feature dimension is normalized in each batch. The input data is normalized by subtracting the mean and dividing by the standard deviation to obtain F′ BN Before entering the next stage, the feature vector is normalized based on the pixel area. The deleted area of the feature map must be restored. In the deep layer of the neural network, layer normalization is used for the network layer output. It does not rely on the statistical information within the batch, but uses the statistical information of each sample on a specific layer for normalization. It can make the network more stable for the input of each sample and help deal with small batches or single samples. The mask is applied to the calculation process of each sample to exclude the influence of the invalid area. The two-stage operation can be expressed by the following formula:
[0095]
[0096]
[0097] in, Represent the feature map F ′ 、F m The pixel value at (n,c,i,j), n represents the nth grid divided regularly, c represents the cth spatial channel, i and j represent the length and width coordinates of the pixel value, represents the intermediate result of batch normalization output, represents the intermediate result of the normalized output of the layer, γ BN and γ LN represents the scale parameter, β BN and β LN represents the translation parameter, and represents the weight parameter to be learned, ∈ is a small number introduced to avoid the denominator being 0, and the final result is the output result F of the feature map guided by the normalization of the result mask MN , about μ BN , μ LN and The definition of is shown in the following formula:
[0098]
[0099] Among them, R u Represents the area not blocked by the mask, which is expressed by the following formula:
[0100]
[0101] Compared with simply using batch normalization or layer normalization, mask-guided normalization has better flexibility. It can adaptively adjust the normalization process and flexibly indicate which samples or features should participate in the normalization process. At the same time, for the case of missing input data, mask-guided normalization can better handle the case of missing data by ignoring the calculation of missing values or treating them as invalid samples. This helps to improve the robustness of the model in the presence of missing values.
[0102] Step 6: Since the kernel transformation module is used in the above steps, this is a method similar to the dynamic transformation of the convolution kernel, which is used to deal with the distortion and stretching of the panoramic image. At the same time, it will also bring about the expansion of the receptive field. For the large receptive field, the present invention has made targeted modifications in the loss function. The loss function uses L1 loss, high receptive field perceptual loss and adversarial loss for training. The high receptive field perceptual loss is obtained through the pre-training network. Evaluate the feature distance between the predicted image and the real image, which is used to compare the similarity of the high-level feature structure between the predicted image and the real image. The definition of high receptive field perceptual loss is as follows:
[0103]
[0104] in, Represents the characteristic information of the real image, Represents the predicted image feature information, img represents the real image, represents the predicted image, and N represents the number of image features.
[0105] The adversarial loss is defined as follows:
[0106]
[0107] Among them, E img [] represents the expected function of the image, E img,m [] represents the expected function of the image mask, ⊙ represents element-by-element multiplication, D() represents the variance function of the image, and m represents the mask.
[0108] The L1 loss is defined as follows:
[0109]
[0110] The overall loss function is defined as follows:
[0111] L total =L1+λ p L p +λ adv L adv
[0112] Among them, λ p The coefficient representing the high receptive field perceptual loss, λ adv represents the coefficient of the resistance loss, in the embodiment of the present invention, λ p =0.05,λ adv =0.1.
[0113] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some or all of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A panoramic image restoration method based on kernel transformation and mask-guided normalization, characterized in that The steps include: Step 1: Superimpose the panoramic image and the mask image accordingly to obtain a pair of panoramic images to be repaired, and map them to the UV plane respectively; Step 2: divide the mapped image into grids, and use the obtained regular grids as the receptive field input convolution kernel for feature extraction; Step 3: Perform RoI pooling operation on the extracted features, optimize the grid position offset, and obtain the RoI feature map; Step 4: Use a multi-head self-attention mechanism on the RoI feature map to learn the long-range feature information in the panoramic image; Step 5, superimposing the outputs of the pair of panoramic images to be restored in step 4, inputting them into the neural network for transmission, first performing batch normalization in the shallow layer of the neural network, using layer normalization in the deep layer of the neural network, normalizing the area by guiding the normalization operation through the mask, combining the features of the occluded area, and applying the mask to the calculation process of each sample when calculating the normalized statistics to eliminate the influence of the invalid area, so as to obtain the feature map after the mask-guided normalization; Step six, based on the mask-guided normalized feature map, a restored panoramic image is obtained, and the restored panoramic image is used as a predicted image, compared with the real image, and the panoramic image restoration process is trained.
2. The method for panoramic image restoration based on kernel transformation and mask-guided normalization according to claim 1, characterized in that: The step 1 comprises the following steps: Step 1.1: Superimpose the panoramic image x and the mask image to obtain the panoramic image x to be repaired. ′ , the panoramic image and the mask image are randomly rotated by a certain angle and then superimposed to obtain the panoramic image to be repaired Step 1.2, the point coordinates on the UV plane correspond to the coordinates of the spherical pixel points on the panoramic image to be repaired: Among them, θ m,n Represents the pixel point P on the UV plane m,n The azimuth angle mapped to the spherical image, Φ m,n Represents the pixel point P on the UV plane m,n The pitch angle, θ, mapped to the spherical image m,n , Φ m,n Commonly expressed P m,n Mapped to the pixel coordinates on the spherical image, P m,n Represents a pixel point on the UV plane, m and n represent the width and height coordinates on the UV plane, and W and H represent the width and height of the UV plane respectively.
3. The method for panoramic image restoration based on kernel transformation and mask-guided normalization according to claim 1, characterized in that: The step 2 comprises the following steps: Step 2.1, input the mapped image into the kernel transformation module, take a pixel point on the sphere as the entry point, take a circle of pixels on the sphere around the tangent point, and divide the grid G on the tangent plane into the grid. The tangent point is used as the origin of the grid to determine the coordinates of each part of the grid G. The entire grid G is input into the convolution kernel as the receptive field for sampling. For any tangent point P i , the output feature map F(P i ); Step 2.2, use the bilinear interpolation method to process the specific sampling position, F(P i ) is decomposed into two dimensions, and D h and D v Two 1D kernels.
4. The method for panoramic image restoration based on kernel transformation and mask-guided normalization according to claim 3, characterized in that: The feature map F(P i )for: Among them, x(·) represents the area to be extracted, w(P i ) represents the tangent point P i The weighting parameter, P n represents a discrete integer position, and ΔP n is relative to P n The offset of 5. The method for panoramic image restoration based on kernel transformation and mask-guided normalization according to claim 3, characterized in that: In step 2.2, the two one-dimensional kernels are as follows: g(a,b)=max(0,1-|ab|) Among them, k represents an arbitrary position, which is composed of P0, P n and △P n Composition, where P0 represents the initial position, in the horizontal direction, through the one-dimensional kernel D h Consider the horizontal position k h and the horizontal offset p h The impact on the interpolation result, in the vertical direction, is through the one-dimensional kernel D v Consider the vertical position k v and the vertical offset p v The impact on the interpolation result, g(a,b) represents the corresponding maximum value operation based on parameters a and b, a and b represent k h and p h , or k v and p v .
6. The method for panoramic image restoration based on kernel transformation and mask-guided normalization according to claim 1, characterized in that: In the step 3, RoI pooling is set in conjunction with kernel transformation to divide the grid into RoI sub-windows, and then the value of each sub-window is pooled to the corresponding output grid unit, wherein RoI pooling is divided into two branches, upper and lower; in the upper branch, the feature map is input into the RoI pooling layer after the convolution operation, and RoI pooling is applied separately to the channel of each feature map to obtain the normalized offset In the lower branch, the feature map is convolved with the output of the upper branch. Perform a channel-by-channel multiplication operation to obtain the actual offset △P i,j , and finally output the RoI feature map after deconvolution operation.
7. The method for panoramic image restoration based on kernel transformation and mask-guided normalization according to claim 1, characterized in that: In step 4, the image feature information is first transformed into two feature spaces f and g with the same structure, and the attention is calculated channel by channel for each space: f(x)=W f x,g(x)=W g x Among them, x i represents the i-th region of the feature space, x j represents the jth region of the feature space, t ij represents the transpose of region i in feature space f multiplied by region j in feature space g, F j,i represents the degree to which the multi-head self-attention module pays attention to the i-th region when synthesizing the j-th region, C represents the number of channels, L represents the number of feature positions of the previous hidden layer feature, and the output of the attention layer is o = {o1, o2, ..., o j ,…,o L }∈R C*L ,in: h(x i )=W h x i Among them, h(x i ) represents the multiplication of region i in the feature space by W h The result of the parameter, vF j,i h(x i ) / represents the multiplication of region i in the feature space by W v The result of the parameter, W g ∈R C*C , W f ∈R C*C , W h ∈R C*C , W v ∈R C*C They are all learned weight matrices, and the final output results serve as the input for the next step of mask-guided normalization.
8. The method for panoramic image restoration based on kernel transformation and mask-guided normalization according to claim 1, characterized in that: In the step 5, the outputs of the panoramic images to be restored in the step 4 are respectively used as input feature maps F in and the mask feature map F m , the mask feature map F m Superimposed on the input feature map F in The selective feature map F is obtained ′ ; Mask-guided normalized feature map F MN as follows: in, Represent the feature graphs F′ and F m The pixel value at (n,c,i,j), n represents the nth grid divided regularly, c represents the cth spatial channel, i and j represent the length and width coordinates of the pixel value, represents the intermediate result of batch normalization output, represents the intermediate result of the normalized output layer, γ BN and γ LN represents the scale parameter, β BN and β LN represents the translation parameter, and Represents the weight parameter to be learned, ∈ is used to avoid the denominator being 0, μ BN , μ LN and The definition is as follows: Among them, R u Represents the area not blocked by the mask, which is expressed by the following formula:
9. The method for panoramic image restoration based on kernel transformation and mask-guided normalization according to claim 1, characterized in that: In step 6, training is performed using loss functions, including a high receptive field perception loss function, an adversarial loss function, and an L1 loss function; High receptive field perceptual loss, through pre-trained network Evaluate the feature distance between the predicted image and the real image, which is used to compare the similarity of the high-level feature structure between the predicted image and the real image, and is defined as follows: in, Represents the characteristic information of the real image, Represents the predicted image feature information, img represents the real image, Represents the predicted image, and N represents the number of image features; The adversarial loss is defined as follows: Among them, E img [] represents the expected function of the image, E img,m [] represents the expected function of the image mask, ⊙ represents element-by-element multiplication, D() represents the variance function of the image, and m represents the mask; The L1 loss is defined as follows: The overall loss function is defined as follows: L total =L1+λ p L p +λ adv L adv Among them, λ p The coefficient representing the high receptive field perceptual loss, λ adv Represents the coefficient of adversarial loss.
Citation Information
Patent Citations
Face image restoration method based on self-attention cascade generative adversarial network
CN112949553A
Face image restoration method based on multi-scale local self-attention generative adversarial network
CN113962893A
Image restoration method based on gating and context attention mechanism
CN113989129A
End-to-end image steganography method capable of resisting physical transmission deformation
CN114037596A
Digital image restoration method based on structural information embedding and attention mechanism
CN114820381A
