Monocular polarization three-dimensional reconstruction method and device based on deep learning, and electronic equipment
Through deep learning technology and polarization information encoding representation, combined with sparse self-attention mechanism and normal gradient integration strategy, the problems of low accuracy, small scope of application and high cost of existing 3D reconstruction methods are solved, and efficient and simplified 3D reconstruction is achieved. Reconstruction effect.
Patent Information
- Application Number
- CN202410674008.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-28
- Publication Date
- 2024-08-30
AI Technical Summary
Existing 3D reconstruction methods have low accuracy, small scope of application, complex structure and high cost, making it difficult to meet the needs of diverse scenarios.
A monocular polarization three-dimensional reconstruction method based on deep learning is used to obtain multiple polarization normal images of the object, calculate the polarization information encoding representation, and utilize the preset two-layer routing sparse self-attention mechanism and discontinuity-preserving normals Gradient integration strategy for 3D reconstruction.
It improves the accuracy and scope of application of three-dimensional reconstruction, simplifies structural design, reduces costs, and achieves efficient reconstruction of complex scenes.
Smart Images

Figure CN118570380A
Abstract
Description
Technical Field
[0001] The present application relates to the field of three-dimensional reconstruction technology, and in particular to a monocular polarization three-dimensional reconstruction method, device and electronic equipment based on deep learning. Background Art
[0002] Three-dimensional reconstruction refers to the establishment of a three-dimensional mathematical model suitable for computer representation and processing for the three-dimensional object to be imaged. Three-dimensional reconstruction technology can reflect the structure, texture, scale and other information of the object that cannot be reflected by two-dimensional images. Three-dimensional reconstruction technology has been widely used in virtual reality, cultural relics protection, navigation and obstacle avoidance and other fields.
[0003] In the related art, the three-dimensional reconstruction technology is mainly a binocular polarization three-dimensional reconstruction method, which realizes the three-dimensional reconstruction of the object surface based on the polarization information obtained by the camera and the depth information obtained by Kinect.
[0004] However, the reconstruction method of this method has low accuracy, small scope of application, complex structure and high cost, which need to be solved urgently. Summary of the invention
[0005] The present application provides a monocular polarization 3D reconstruction method, device and electronic device based on deep learning to solve the problems of low accuracy, small scope of application, complex structure and high cost of existing 3D reconstruction methods. While simplifying the structure, it improves the reconstruction accuracy and scope of application.
[0006] To achieve the above objectives, the first embodiment of the present application proposes a monocular polarization 3D reconstruction method based on deep learning, comprising the following steps:
[0007] Acquiring a plurality of polarization normal images of the object to be reconstructed;
[0008] Calculate the polarization information encoding representation corresponding to each polarization normal image, and input the polarization information encoding representation corresponding to each polarization normal image into a preset deep learning model, and use the preset double-layer routing sparse self-attention mechanism to obtain the polarization normal image prediction result;
[0009] The polarization normal image prediction result is three-dimensionally reconstructed using a preset discontinuity-preserving normal gradient integration strategy to obtain a three-dimensional reconstruction result of the object to be reconstructed.
[0010] According to one embodiment of the present application, the polarization information encoding is expressed as:
[0011]
[0012] Among them, cat is the splicing operation, S0 is the intensity of light, S1 is the intensity difference of the polarization component parallel to the reference plane and perpendicular to the reference plane in the electromagnetic wave, S2 is the intensity difference of the polarization component with an angle of 45° and -45° relative to the reference plane, ρ is the linear polarization degree, is the linear polarization angle, v d is the viewing direction of the pixel.
[0013] According to one embodiment of the present application, the preset sparse self-attention mechanism of the two-layer routing is:
[0014] O=Attentiom(Q,K g ,V g )+LCE(V);
[0015] Among them, O is the attention output, Q is the query, and K g 、V g For the constructed input key-value pairs, LCE is a depth convolution.
[0016] According to one embodiment of the present application, before the polarization information encoding representation is input into the preset deep learning model, the method further includes:
[0017] Acquire a polarization reconstruction dataset consisting of historical polarization normal images, preprocess the polarization reconstruction dataset, and divide the preprocessed polarization reconstruction dataset into a training set and a validation set;
[0018] The preset neural network is trained using the training set to obtain an initial deep learning model, and the initial deep learning model is verified using the verification set until the initial deep learning model meets the preset training criteria, and the iterative training of the preset neural network is terminated to obtain the preset deep learning model, otherwise the iterative training is continued after adjusting the training set of the preset neural network.
[0019] According to an embodiment of the present application, the step of training a preset neural network using the training set to obtain an initial deep learning model, and verifying the initial deep learning model using the verification set until the initial deep learning model meets a preset training standard includes:
[0020] Based on a preset initial learning rate, using the training set to train the preset neural network to obtain the initial deep learning model;
[0021] Obtaining a preset loss function according to a difference between the polarization normal image prediction result and the actual result of the polarization normal image in the verification set;
[0022] Determining whether the initial deep learning model meets the preset training standard according to the preset loss function;
[0023] If the initial deep learning model does not meet the preset training criteria, the preset initial learning rate is adjusted based on the cosine annealing strategy, and the steps of re-executing the preset initial learning rate and using the training set to train the preset neural network to obtain the initial deep learning model are performed until the initial deep learning model meets the preset training criteria.
[0024] According to the monocular polarization 3D reconstruction method based on deep learning proposed in the embodiment of the present application, by calculating the polarization information encoding representation corresponding to each polarization normal image of the object to be reconstructed, and then inputting the polarization information encoding representation corresponding to each polarization normal image into the preset deep learning model, the polarization normal image prediction result can be obtained by using the preset sparse self-attention mechanism of the double-layer routing; the polarization normal image prediction result is three-dimensionally reconstructed using the preset non-continuity-preserving normal gradient integration strategy, and the 3D reconstruction result of the object to be reconstructed can be obtained. Therefore, by creating a new polarization information encoding representation method, combined with the sparse self-attention mechanism of the double-layer routing and the non-continuity-preserving normal gradient integration strategy, the problems of low accuracy, small scope of application, complex structure and high cost of the existing 3D reconstruction method are solved, and the reconstruction accuracy and scope of application are improved while simplifying the structure.
[0025] To achieve the above-mentioned purpose, the second embodiment of the present application proposes a monocular polarization 3D reconstruction device based on deep learning, comprising:
[0026] An acquisition module, used for acquiring a plurality of polarization normal images of the object to be reconstructed;
[0027] A processing module, used to calculate the polarization information encoding representation corresponding to each polarization normal image, and input the polarization information encoding representation corresponding to each polarization normal image into a preset deep learning model, and use the preset double-layer routing sparse self-attention mechanism to obtain the polarization normal image prediction result;
[0028] The reconstruction module is used to perform three-dimensional reconstruction on the polarization normal image prediction result by using a preset discontinuity-preserving normal gradient integration strategy to obtain a three-dimensional reconstruction result of the object to be reconstructed.
[0029] According to one embodiment of the present application, the polarization information encoding is expressed as:
[0030]
[0031] Among them, cat is the splicing operation, S0 is the intensity of light, S1 is the intensity difference of the polarization component parallel to the reference plane and perpendicular to the reference plane in the electromagnetic wave, S2 is the intensity difference of the polarization component with an angle of 45° and -45° relative to the reference plane, ρ is the linear polarization degree, is the linear polarization angle, v d is the viewing direction of the pixel.
[0032] According to one embodiment of the present application, the preset sparse self-attention mechanism of the two-layer routing is:
[0033] O=Attention(Q,K g ,V g )+LCE(V);
[0034] Among them, O is the attention output, Q is the query, and K g 、V g For the constructed input key-value pairs, LCE is a depth convolution.
[0035] According to one embodiment of the present application, before inputting the polarization information encoding representation into the preset deep learning model, the processing module further includes:
[0036] A preprocessing unit, used for acquiring a polarization reconstruction data set composed of historical polarization normal images, preprocessing the polarization reconstruction data set, and dividing the preprocessed polarization reconstruction data set into a training set and a validation set;
[0037] A training unit is used to train a preset neural network using the training set to obtain an initial deep learning model, and to verify the initial deep learning model using the verification set, until the initial deep learning model meets the preset training criteria, and then terminate the iterative training of the preset neural network to obtain the preset deep learning model; otherwise, the iterative training continues after adjusting the training set of the preset neural network.
[0038] According to one embodiment of the present application, the training unit is specifically used for:
[0039] Based on a preset initial learning rate, using the training set to train the preset neural network to obtain the initial deep learning model;
[0040] Obtaining a preset loss function according to a difference between the polarization normal image prediction result and the actual result of the polarization normal image in the verification set;
[0041] Determining whether the initial deep learning model meets the preset training standard according to the preset loss function;
[0042] If the initial deep learning model does not meet the preset training criteria, the preset initial learning rate is adjusted based on the cosine annealing strategy, and the steps of re-executing the preset initial learning rate and using the training set to train the preset neural network to obtain the initial deep learning model are performed until the initial deep learning model meets the preset training criteria.
[0043] According to the monocular polarization 3D reconstruction device based on deep learning proposed in the embodiment of the present application, by calculating the polarization information encoding representation corresponding to each polarization normal image of the object to be reconstructed, and then inputting the polarization information encoding representation corresponding to each polarization normal image into the preset deep learning model, the polarization normal image prediction result can be obtained by using the preset double-layer routing sparse self-attention mechanism; the polarization normal image prediction result is three-dimensionally reconstructed using the preset discontinuity-preserving normal gradient integration strategy, and the 3D reconstruction result of the object to be reconstructed can be obtained. Therefore, by creating a new polarization information encoding representation method, combined with the sparse self-attention mechanism of the double-layer routing and the discontinuity-preserving normal gradient integration strategy, the problems of low accuracy, small scope of application, complex structure and high cost of the existing 3D reconstruction method are solved, and the reconstruction accuracy and scope of application are improved while simplifying the structure.
[0044] To achieve the above-mentioned objectives, the third aspect embodiment of the present application proposes an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the monocular polarization three-dimensional reconstruction method based on deep learning as described in the above-mentioned embodiment.
[0045] To achieve the above-mentioned objectives, the fourth aspect of the present application proposes a computer-readable storage medium on which a computer program is stored, and the program is executed by a processor to implement the monocular polarization three-dimensional reconstruction method based on deep learning as described in the above-mentioned embodiment.
[0046] To achieve the above objectives, the fifth aspect of the present application proposes a computer program product, including a computer program, which, when executed by a processor, is used to implement the monocular polarization three-dimensional reconstruction method based on deep learning as described in the above embodiments.
[0047] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0049] Figure 1 A flowchart of a monocular polarization 3D reconstruction method based on deep learning provided according to an embodiment of the present application;
[0050] Figure 2 A schematic diagram of the reflected light polarization measurement principle according to an embodiment of the present application;
[0051] Figure 3Schematic diagram of four polarizers with different angles integrated on a CMOS for a polarization camera according to an embodiment of the present application;
[0052] Figure 4 A schematic diagram of a classic attention calculation principle according to an embodiment of the present application;
[0053] Figure 5 A schematic diagram of the calculation principle of the sparse self-attention mechanism of the preset double-layer routing according to an embodiment of the present application;
[0054] Figure 6 A schematic diagram of an overall network structure according to an embodiment of the present application;
[0055] Figure 7 A block diagram of a monocular polarization 3D reconstruction device based on deep learning provided according to an embodiment of the present application;
[0056] Figure 8 It is a schematic diagram of the structure of an electronic device provided according to an embodiment of the present application. DETAILED DESCRIPTION
[0057] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.
[0058] The following describes a monocular polarization 3D reconstruction method, device, and electronic device based on deep learning proposed in accordance with an embodiment of the present application with reference to the accompanying drawings. First, the monocular polarization 3D reconstruction method based on deep learning proposed in accordance with an embodiment of the present application will be described with reference to the accompanying drawings.
[0059] Figure 1 This is a flowchart of a monocular polarization 3D reconstruction method based on deep learning according to an embodiment of the present application.
[0060] Before introducing the monocular polarization 3D reconstruction method based on deep learning proposed in the embodiment of the application, the 3D reconstruction method in the related art is briefly introduced.
[0061] In the related technology, the three-dimensional reconstruction methods include: (1) combining the Kinect depth camera to obtain coarse depth information and polarization fusion, combining the coarse depth map to solve the azimuth ambiguity and correct the refractive index distortion, and using the polarization degree as the weight for integration to obtain the three-dimensional shape; (2) proposing the constraints between the three-view geometry of polarization, combining the corresponding relationship between the diffuse reflection part components of the object under the mixed polarization model, and using the specular reflection part to build inference for deblurring. This method can realize the estimation of the camera pose while effectively removing the ambiguity of the polarization angle; (3) considering that the reflections in the scene are dominated by diffuse reflections, the optimization problem is constructed using the matching relationship between two points of the object and their normal vectors between two frames in a continuous sequence of frames. Obtain the pose estimation result between two frames, combine the pose estimation result with the matching relationship of the normal vector to remove the ambiguity of other points, and combine the motion recovery structure method to realize dense mapping; (4) It is proposed to combine the existing polarization physical model with the deep learning method, and use the fuzzy normal derived from the Fresnel reflection as the physical prior information input model to realize data-driven polarization recovery shape. However, the model has low accuracy and is limited by the material, and the calculation of prior information is complex; (5) Combine polarization and binocular RGB cameras, use the binocular to obtain rough depth information to correct the polarization recovery normal, and it can also be used to estimate the diffuse reflectivity. This method can obtain dense target three-dimensional graphics; (6 ) Considering the problem of non-unique normals caused by unknown refractive index when using shadow to restore normals, the assumption that the surface of the object is locally convex is introduced, and the unique normal is restored by combining polarization information with shadow. However, this method is still limited to the Lambertian body model and requires the surface of the object to be monochrome; (7) Using shadow information and polarization information to restore normals, and using the approximate shape obtained by the object silhouette as a priori constraint to overcome the limitation of the single color of the object, this method can estimate the normal of the surface of multi-color objects. However, this method is also limited to the Lambertian body assumption and requires the light source to be very close to the camera; (8) Noting the azimuth deblurring problem and the reliance on Lambertian in the shape recovery method To address the problem of the Lambertian body hypothesis, a monocular polarization 3D imaging method for non-Lambertian bodies is proposed. By analyzing the subtle differences between specular reflection and diffuse reflection, the independent component analysis method is used to separate the two. This process does not require the introduction of additional information. The separated pure diffuse reflection component is combined to derive the gradient field to obtain the surface normal. The ambiguity is removed by gradient field optimization, and the shape of the face is restored under outdoor natural lighting conditions. However, its accuracy is limited. (9) A new data-driven polarization 3D reconstruction method based on physical priors is proposed, which can restore the scene-level normal estimation result from a single polarization image, and obtains better accuracy than previous physics-based and learning-based methods.(10) Considering that the existing polarization-based shape recovery methods have poor reconstruction effects for transparent object shape estimation due to noise interference, it is proposed to use the physical prior information that the transmission component in the polarization image has more noise than the reflection component, introduce confidence to determine the impact of interference, and construct a network Trans SFP (Small Form-factor Pluggable) with a multi-branch structure to avoid the destruction of the relationship between inputs at different levels. At the same time, a transparent object polarization 3D reconstruction dataset is constructed. This method achieves better accuracy than previous methods in the transparent object dataset, but this method is limited to transparent objects. ;
[0062] However, when the related technology is combined with the polarization information of the object for reconstruction, it is limited by the ambiguity in the polarization information solution, and additional constraints need to be introduced to disambiguate. Combining active sensors or additional cameras for polarization information disambiguation will introduce additional equipment, which will reduce the simplicity of the system, increase the cost, and reduce the scope of application. When combining additional information such as luminosity, special light source constraints or reflection type constraints are generally introduced. For requirements for specific light sources or object surfaces with specific reflection types, these constraints will limit the scope of application of the method. Once the constraints are not met, the accuracy will decrease. The deep learning-based approach has fewer constraints, but the accuracy still needs to be further improved, and the polarization information representation method used for model input has specific limitations. The computational complexity and the efficiency of prior information representation need to be improved.
[0063] It is precisely based on the above problems that the embodiment of the present application proposes a monocular polarization 3D reconstruction method based on deep learning, which calculates the polarization information encoding representation corresponding to each polarization normal image of the object to be reconstructed, and then inputs the polarization information encoding representation corresponding to each polarization normal image into a preset deep learning model, and uses the preset sparse self-attention mechanism of the double-layer routing to obtain the polarization normal image prediction result; the polarization normal image prediction result is three-dimensionally reconstructed using the preset non-continuity-preserving normal gradient integration strategy, and the 3D reconstruction result of the object to be reconstructed can be obtained. Therefore, by creating a new polarization information encoding representation method, combined with the sparse self-attention mechanism of the double-layer routing and the non-continuity-preserving normal gradient integration strategy, the problems of low accuracy, small scope of application, complex structure and high cost of the existing 3D reconstruction method are solved, and the reconstruction accuracy and scope of application are improved while simplifying the structure.
[0064] For example, Figure 1 As shown, the monocular polarization 3D reconstruction method based on deep learning includes the following steps:
[0065] In step S101 , a plurality of polarization normal images of the object to be reconstructed are acquired.
[0066] It can be understood that the polarization normal image is an image that describes the reflection characteristics of the object surface at different polarization angles, and each angle has a corresponding polarization normal image. Polarization is a property of light waves that describes the vibration direction of the electric field vector in the light wave. The polarization normal image can usually be obtained through polarization imaging technology, which uses polarization-sensitive detectors or cameras to capture the reflected light waves of an object at different polarization angles. By analyzing and processing these images, the polarization reflection characteristics of the object surface can be obtained, and then the shape, texture, material and other information of the object can be extracted.
[0067] In step S102, the polarization information encoding representation corresponding to each polarization normal image is calculated, and the polarization information encoding representation corresponding to each polarization normal image is input into a preset deep learning model, and the polarization normal image prediction result is obtained by using the preset two-layer routing sparse self-attention mechanism.
[0068] That is to say, after obtaining multiple polarization normal images of the object to be reconstructed, the polarization information coding representation corresponding to each polarization normal image can be calculated based on the polarization angle and polarization degree, and a deep learning model suitable for processing the polarization normal image task is selected. The polarization information coding representation corresponding to each polarization normal image is used as input data and input into the trained preset deep learning model. The model can then generate a polarization normal image prediction result based on the input polarization information coding representation. At the same time, the embodiment of the present application also adopts a preset two-layer routing sparse self-attention mechanism to enhance the preset deep learning model's ability to utilize and associate global context information, thereby improving the performance of the model.
[0069] In some embodiments, the polarization information encoding is expressed as:
[0070]
[0071] Among them, cat is the splicing operation, S0 is the intensity of light, S1 is the intensity difference of the polarization component parallel to the reference plane and perpendicular to the reference plane in the electromagnetic wave, S2 is the intensity difference of the polarization component with an angle of 45° and -45° relative to the reference plane, ρ is the linear polarization degree, is the linear polarization angle, v d is the viewing direction of the pixel.
[0072] It can be understood that in order to achieve better polarization normal estimation accuracy, the embodiments of the present application can adopt a polarization normal estimation method based on deep learning, and by improving the expression method of polarization information, the deep learning model can better extract physical prior knowledge from the polarization information.
[0073] Specifically, the polarization state of light can be expressed by the four-parameter Stokes vector, namely:
[0074] S=[S0,S1,S2,S3] T ; (2)
[0075] Among them, S0 is the intensity of light, S1 is the intensity difference between the polarization components parallel to the reference plane and perpendicular to the reference plane in the electromagnetic wave, S2 is the intensity difference between the polarization components with angles of 45° and -45° relative to the reference plane, and S3 is the intensity of the circular polarization component.
[0076] Since the interaction between light and medium includes reflection, refraction, etc., the Mueller matrix can be used for modeling. Assume that the Stokes vector of the incident light is S i , after being reflected from a certain point in the medium, the polarization state of the light is S R , assuming that the Mueller matrix of the reflection point is M R , then:
[0077] S R =M R S i ; (3)
[0078] S R =[S 0R ,S 1R ,S 2R ,S 3R ] T ; (4)
[0079] Among them, M R It is related to the direction and material of the medium surface. For ordinary cameras, only S in the reflected light can be measured. 0R Component, that is, the intensity of light. If you want to measure polarization information, you need to use a polarizer to measure it. For a polarizer with a polarization angle of θ, its transmission behavior can be expressed using the Mueller matrix M θ Modeling, such as Figure 2 As shown, after the reflected light passes through the polarizer with a polarization angle of θ, the polarization state of the light can be obtained as:
[0080] S′=M θ S R =M θ M R S i ; (5)
[0081] Among them, for the Mueller matrix M θ The definition is as follows:
[0082]
[0083] The intensity term of S1 measured by the camera after passing through the polarizer is:
[0084]
[0085] The intensity of light after passing through the polarizer is related to the polarization component of the light before passing through the polarizer. Therefore, the polarization component S of the light can be restored by measuring the light intensity at least three times with polarizers at different angles. 0R , S 1R , S 2R .
[0086] The embodiment of the present application adopts a focal plane camera, which integrates four polarizers of different directions (angles) on the CMOS. Figure 3 As shown, the measurement results at four different polarizer angles can be obtained through one shot. In the reflection process, taking the incident surface as a reference and the CMOS horizontal direction as 0°, the Stokes vector of the reflected light can be calculated by substituting it into formula (7):
[0087]
[0088] Since the linear polarizer can only measure the linear polarization of light, the circular polarization component of light is ignored, the linear polarization degree ρ and the linear polarization angle It can be calculated as follows:
[0089]
[0090] The physical meaning of the polarization angle is the angle between the polarization direction of light and the incident plane. The degree of polarization indicates the degree of polarization of light, and its range is between [0, 1].
[0091] Using a polarization image taken from a focal plane polarization camera, which includes polarization normal images at four different polarization angles of 0°, 45°, 90°, and 135°, before inputting the preset deep learning model, the embodiment of the present application can first calculate the first three components of the Stokes vector according to formula (8), and normalize S1 and S2 to obtain the normalized Stokes vector In addition, the embodiment of the present application can also calculate the linear polarization degree ρ and the linear polarization angle And calculate the corresponding polarization angle encoding representation of the linear polarization angle As shown in formula (11), the advantage of this expression method over the original polarization angle is that even if the polarization angle π is ambiguous, it will not affect the result of the polarization angle encoding method.
[0092]
[0093] It should be noted that when the camera projection model is different, the actual calculation method of the polarization angle is different. There is a certain degree of error in the polarization angle calculated by the two different methods. In order to reduce this effect, the embodiment of the present application calculates the observation direction v of each pixel point at each position. d, and use it as the model input, so that the model can combine the observation direction to finally estimate a more accurate normal result (that is, obtain a more accurate polarization normal estimation image). Therefore, the polarization information encoding representation shown in formula (1) is finally used as the input of the preset deep learning model, where v d The number of channels is 3, and the number of input channels in the embodiment of the present application is 9.
[0094] The sparse self-attention mechanism of the preset two-layer routing is explained in detail below.
[0095] In the preset two-layer routing sparse self-attention mechanism, each image block is associated with a position router, which assigns image blocks to upper and lower routers according to specific rules. The upper router is used to capture global context information, interact with all images through the global self-attention mechanism, and generate a global image representation. The lower router is used to capture the details of the local area, use the local self-attention mechanism to interact with each image block and its adjacent image blocks, and generate a local image representation.
[0096] As a possible implementation method, in some embodiments, the preset sparse self-attention mechanism of the two-layer routing is:
[0097] O = Attention(Q, K g ,V g )+LCE(V); (12)
[0098] Among them, O is the attention output, Q is the query, and K g 、V g For the constructed input key-value pairs, LCE is a deep convolution used as an enhancement item for the local context.
[0099] It is understandable that the self-attention mechanism can capture the dependencies between long-distance contexts and realize the focus on the global information of features. The classic attention is shown in formula (13):
[0100]
[0101] Where Q is the query, K and V are key-value pairs.
[0102] For multi-head self-attention, Q, K, V all come from the input X∈R N×C Linear projection, for image features, N = H × W, where H is the height of the image and W is the width of the image. The complexity of multi-head self-attention calculation is O((HW) 2 ), its principle is as follows Figure 4 shown.
[0103] However, the sparse self-attention of two-layer routing is different from the general self-attention calculation. Its calculation principle is as follows Figure 5 As shown, first, the image features are divided into non-overlapping S×S feature blocks, and the input X∈R H×W×C Refactored to Then perform linear mapping on them respectively to obtain query Q, key K and value V:
[0104] Q=X r W q ,K=X r W k ,V=X r W v ; (14)
[0105] The participation relationship between different regions is determined by constructing a directed graph, and the specific regions that each region should participate in are calculated. Specifically, the adjacency matrix A is obtained by calculating the inner product of the query and the key region by region. r :
[0106] A r =Q r (K r ) T ; (15)
[0107] in, A r The middle element indicates the semantic correlation between different regions.
[0108] Through A r By sorting the elements in each row and retaining the first k most relevant regions in each row, we can get the routing index matrix:
[0109]
[0110] I r The i-th row of contains the k subscripts corresponding to the most relevant regions, according to I r The subscripts in reconstruct the key-value pairs:
[0111] K g =gather(K,I r ),V g =gather(V,I r ); (17)
[0112] in,
[0113] Apply the filtered K to query Q g 、V g Calculate the attention output, as shown in formula (12). The complexity of this attention calculation is Since the key-value pairs are screened when calculating attention, each query does not calculate all key-value pairs, but only the most relevant areas. Therefore, this is a sparse attention calculation scheme that screens out redundant information and avoids some invalid calculations, thereby improving calculation efficiency.
[0114] In step S103, a three-dimensional reconstruction is performed on the polarization normal image prediction result using a preset discontinuity-preserving normal gradient integration strategy to obtain a three-dimensional reconstruction result of the object to be reconstructed.
[0115] Among them, the preset discontinuity-preserving normal gradient integration strategy means that in the process of calculating the surface normal of an object, not only the smooth changes of the object surface are considered, but also the discontinuities on the object surface (such as edges, corners, etc.) are considered and retained. Normal gradient integration refers to using the changes in the normal data of the object surface (ie, gradient) to infer the geometric shape of the surface. Since the normal defines the local direction of the surface at each point, the shape of the surface can be gradually constructed through the integration direction.
[0116] That is to say, Figure 6 As shown, after obtaining the polarization normal image prediction result, the polarization normal image prediction result can be reconstructed three-dimensionally using the preset discontinuity-preserving normal gradient integration strategy, that is, the gradient of each pixel in the polarization normal image is calculated using the preset discontinuity-preserving normal gradient integration strategy, and the edges and discontinuities in the image are maintained when integrating the gradient using the discontinuity-preserving strategy to obtain the final integration result, and then the preset deep learning model is used to generate a three-dimensional representation of the object (that is, the three-dimensional reconstruction result of the object to be reconstructed), and the obtained three-dimensional reconstruction result is subjected to necessary post-processing, such as smoothing, denoising, etc., to improve the quality of the three-dimensional model.
[0117] The preset discontinuity-preserving normal gradient integration strategy is described in detail below.
[0118] Most conventional integration methods are limited to recovering smooth surfaces and lack the preservation of depth discontinuities. To this end, the present embodiment may first assume a semi-smooth surface, that is, the discontinuity point is only discontinuous on one side and continuous on the other side. Assume p = [x, y, z] ∈ R 3 is a surface point in 3D space, n(p) = [ns,ny,nz]∈S 2 ∈R 3 is the unit surface normal vector at the surface point p. When the camera observes the surface of an object, the surface point and its normal vector are projected to the coordinates u = [u, v] ∈ R 2Therefore, the embodiment of the present application can parameterize the surface and its normal mapping as vector value functions p(u)=[x(u), y(u), z(u)] and n(u)=[nx(u), ny(u), nz(u)]. According to the definition, the normal vector n(u) is orthogonal to the surface tangent plane at point p(u), so n(u) is orthogonal to the two tangent vectors in the tangent plane at p(u):
[0119]
[0120] in, is the partial differential symbol.
[0121] The spatial point p and the corresponding partial differential result are:
[0122]
[0123] Substituting into the partial differential equation we get:
[0124]
[0125] The purpose of the integration is to solve the depth z in the above formula by minimizing the cost function according to the partial differential equation (20):
[0126]
[0127] Solving equation (21) directly means that z is differentiable everywhere, that is, assuming a smooth plane, the target surface is differentiable everywhere. When a point on the target surface is differentiable, both sides of the point are differentiable. Therefore, the equation can be split into two one-sided differential results:
[0128]
[0129] Where the differential on each side is defined as:
[0130]
[0131] Since it is not differentiable everywhere in actual situations, the embodiment of the present application adopts the semi-smooth surface assumption, that is, at least one side is differentiable, that is, and At least one of them exists. Therefore, considering that only one of the two sides may exist, different weights are used for the partial differential constraint equations on both sides, and the cost function is:
[0132]
[0133] Among them, the weight ω u ,ω v It can be defined as:
[0134]
[0135] Next, the weight is calculated based on the differentiability of both sides. The weight is calculated by constructing a weight discriminant. Taking the horizontal direction u as an example, the right derivative is:
[0136]
[0137] Similarly, calculate the left derivative For the continuous side, its weight discriminant should theoretically be 0, and the weight discriminant of the discontinuous side is non-zero.
[0138] By judging and As a result, if the result is 0, it means that both sides are continuous; if the result is greater than 0, it means that the right derivative is continuous, ω u is 1, otherwise ω u is -1, and ω can be calculated in the same way v .
[0139] Finally, the weights calculated according to the above process are substituted into the cost function, and the depth z is restored by minimizing the cost function to obtain the 3D reconstruction result of the object to be reconstructed.
[0140] Next, we will explain in detail how to obtain the preset deep learning model.
[0141] As a possible implementation method, in some embodiments, before the polarization information encoding representation is input into a preset deep learning model, it also includes: obtaining a polarization reconstruction data set consisting of historical polarization normal images, preprocessing the polarization reconstruction data set, and dividing the preprocessed polarization reconstruction data set into a training set and a verification set; using the training set to train a preset neural network to obtain an initial deep learning model, and using the verification set to verify the initial deep learning model until the initial deep learning model meets the preset training criteria, and ending the iterative training of the preset neural network to obtain the preset deep learning model, otherwise adjusting the training set of the preset neural network and continuing the iterative training.
[0142] Specifically, historical polarization normal images are obtained, which can come from different objects, scenes or conditions to ensure the generalization ability of the model. These images constitute a polarization reconstruction data set, and the polarization reconstruction data set is preprocessed as necessary, such as noise removal, standardization, image enhancement, etc., to improve the image quality and the accuracy of subsequent processing. The preprocessed polarization reconstruction data set is divided into a training set and a validation set. The training set is used to train the deep learning model, and the validation set is used to evaluate the performance of the model during the training process so as to adjust the model. A suitable neural network structure is selected as a preset neural network (such as a convolutional neural network (CNN)), and the preset neural network is trained using the training set to obtain an initial deep learning model. After each training cycle, the initial deep learning model is verified using the validation set, and the model's hyperparameters (such as learning rate, etc.) or network structure are adjusted according to the verification results. The training and verification process is repeated until the initial deep learning model meets the preset training standard, that is, the model converges, then the iterative training of the preset neural network is terminated to obtain the final preset deep learning model, and the trained preset deep learning model is used to process new polarization normal images to perform three-dimensional reconstruction tasks.
[0143] Furthermore, in some embodiments, a preset neural network is trained using a training set to obtain an initial deep learning model, and the initial deep learning model is verified using a validation set until the initial deep learning model meets a preset training standard, including: based on a preset initial learning rate, training a preset neural network using a training set to obtain an initial deep learning model; obtaining a preset loss function based on the difference between the predicted result of the polarization normal image and the actual result of the polarization normal image in the validation set; judging whether the initial deep learning model meets the preset training standard based on the preset loss function; if the initial deep learning model does not meet the preset training standard, adjusting the preset initial learning rate based on a cosine annealing strategy, and re-executing the step of training a preset neural network using a training set based on the preset initial learning rate to obtain an initial deep learning model until the initial deep learning model meets the preset training standard.
[0144] The preset initial learning rate may be pre-set by researchers in the field, obtained through a limited number of experiments, or obtained through a limited number of computer simulations, which is not specifically limited here. Preferably, the preset initial learning rate is set to 0.0001 in the embodiment of the present application.
[0145] Specifically, in the process of training the preset neural network using the training set, the model parameters are updated through back propagation and optimizer (such as Adam). Based on the preset initial learning rate (such as 0.0001), the preset neural network is trained using the training set to obtain the initial deep learning model, that is, the polarization normal image is read from the training set, and its corresponding polarization information encoding representation is calculated. After inputting it into the model, the polarization normal image prediction result is obtained. According to the difference between the polarization normal image prediction result and the actual result of the polarization normal image in the validation set, the cosine similarity is calculated as the preset loss function, that is:
[0146]
[0147] Among them, y is the true result (true value) of the polarization normal image, and y1 is the predicted result of the polarization normal image.
[0148] According to the preset loss function, it is judged whether the initial deep learning model meets the preset training standard (that is, whether the loss function value no longer decreases significantly). If the initial deep learning model does not meet the preset training standard, the preset initial learning rate is adjusted and updated based on the cosine annealing strategy, and iterative training is performed until the initial deep learning model meets the preset training standard.
[0149] In summary, the embodiment of the present application adopts a polarization normal estimation method based on deep learning. By combining the Stokes vector to improve the encoding representation of polarization information, the deep learning model can better extract physical prior knowledge from the polarization information, so that the model can better perceive details; at the same time, a sparse self-attention mechanism of double-layer routing is used to enhance the model's ability to utilize and associate global context information, thereby improving the performance of the model and effectively eliminating the ambiguity problem of polarization normal estimation; and, a normal gradient integration method with discontinuity preservation is adopted, so that the final restored three-dimensional structure diagram can restore the edges of depth discontinuities, further improving the accuracy of the reconstruction results. In addition, the present application is a passive reconstruction method. The polarization camera can achieve reconstruction by taking an image of an object from a single angle. The system is simple and convenient, with high accuracy, no special requirements for materials, and a wide range of applications.
[0150] According to the monocular polarization 3D reconstruction method based on deep learning proposed in the embodiment of the present application, by acquiring multiple polarization normal images of the object to be reconstructed, and calculating the polarization information coding representation corresponding to each polarization normal image, and then inputting the polarization information coding representation corresponding to each polarization normal image into the preset deep learning model, the polarization normal image prediction result can be obtained by using the preset sparse self-attention mechanism of the double-layer routing; the polarization normal image prediction result is three-dimensionally reconstructed using the preset non-continuity-preserving normal gradient integration strategy, and the 3D reconstruction result of the object to be reconstructed can be obtained. Therefore, by creating a new polarization information coding representation method, combined with the sparse self-attention mechanism of the double-layer routing and the non-continuity-preserving normal gradient integration strategy, the problems of low accuracy, small scope of application, complex structure and high cost of the existing 3D reconstruction method are solved, and the reconstruction accuracy and scope of application are improved while simplifying the structure.
[0151] Next, a monocular polarization 3D reconstruction device based on deep learning proposed in accordance with an embodiment of the present application is described with reference to the accompanying drawings.
[0152] Figure 7 It is a block diagram of a monocular polarization 3D reconstruction device based on deep learning according to an embodiment of the present application.
[0153] like Figure 7 As shown, the deep learning-based monocular polarization 3D reconstruction device 10 includes: an acquisition module 100 , a processing module 200 and a reconstruction module 300 .
[0154] Wherein, the acquisition module 100 is used to acquire a plurality of polarization normal images of the object to be reconstructed;
[0155] The processing module 200 is used to calculate the polarization information encoding representation corresponding to each polarization normal image, and input the polarization information encoding representation corresponding to each polarization normal image into a preset deep learning model, and obtain the polarization normal image prediction result by using the preset double-layer routing sparse self-attention mechanism;
[0156] The reconstruction module 300 is used to perform three-dimensional reconstruction on the polarization normal image prediction result by using a preset discontinuity-preserving normal gradient integration strategy to obtain a three-dimensional reconstruction result of the object to be reconstructed.
[0157] Further, in some embodiments, the polarization information encoding is expressed as:
[0158]
[0159] Among them, cat is the splicing operation, S0 is the intensity of light, S1 is the intensity difference of the polarization component parallel to the reference plane and perpendicular to the reference plane in the electromagnetic wave, S2 is the intensity difference of the polarization component with an angle of 45° and -45° relative to the reference plane, ρ is the linear polarization degree, is the linear polarization angle, v d is the viewing direction of the pixel.
[0160] Furthermore, in some embodiments, the preset sparse self-attention mechanism of the two-layer routing is:
[0161] O=Attention(Q,K g ,V g )+LCE(V);
[0162] Among them, O is the attention output, Q is the query, and K g 、V g For the constructed input key-value pairs, LCE is a depth convolution.
[0163] Furthermore, in some embodiments, before inputting the polarization information encoding representation into the preset deep learning model, the processing module 200 further includes:
[0164] A preprocessing unit, used for acquiring a polarization reconstruction data set composed of historical polarization normal images, preprocessing the polarization reconstruction data set, and dividing the preprocessed polarization reconstruction data set into a training set and a validation set;
[0165] A training unit is used to train a preset neural network using a training set to obtain an initial deep learning model, and to verify the initial deep learning model using a verification set until the initial deep learning model meets a preset training standard, thereby terminating the iterative training of the preset neural network to obtain the preset deep learning model, otherwise, the iterative training continues after adjusting the training set of the preset neural network.
[0166] Furthermore, in some embodiments, the training unit is specifically configured to:
[0167] Based on the preset initial learning rate, the preset neural network is trained using the training set to obtain the initial deep learning model;
[0168] According to the difference between the predicted result of the polarization normal image and the actual result of the polarization normal image in the validation set, a preset loss function is obtained;
[0169] Determine whether the initial deep learning model meets the preset training standard based on the preset loss function;
[0170] If the initial deep learning model does not meet the preset training criteria, the preset initial learning rate is adjusted based on the cosine annealing strategy, and the steps of re-executing the preset initial learning rate and using the training set to train the preset neural network to obtain the initial deep learning model are performed until the initial deep learning model meets the preset training criteria.
[0171] It should be noted that the aforementioned explanation of the embodiment of the monocular polarization 3D reconstruction method based on deep learning is also applicable to the monocular polarization 3D reconstruction device based on deep learning in this embodiment, and will not be repeated here.
[0172] According to the monocular polarization 3D reconstruction device based on deep learning proposed in the embodiment of the present application, by acquiring multiple polarization normal images of the object to be reconstructed, and calculating the polarization information coding representation corresponding to each polarization normal image, and then inputting the polarization information coding representation corresponding to each polarization normal image into the preset deep learning model, the polarization normal image prediction result can be obtained by using the preset sparse self-attention mechanism of the double-layer routing; the polarization normal image prediction result is three-dimensionally reconstructed using the preset non-continuity-preserving normal gradient integration strategy, and the 3D reconstruction result of the object to be reconstructed can be obtained. Therefore, by creating a new polarization information coding representation method, combined with the sparse self-attention mechanism of the double-layer routing and the non-continuity-preserving normal gradient integration strategy, the problems of low accuracy, small scope of application, complex structure and high cost of the existing 3D reconstruction method are solved, and the reconstruction accuracy and scope of application are improved while simplifying the structure.
[0173] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device may include:
[0174] A memory 801 , a processor 802 , and a computer program stored in the memory 801 and executable on the processor 802 .
[0175] When the processor 802 executes the program, the monocular polarization 3D reconstruction method based on deep learning provided in the above embodiment is implemented.
[0176] Furthermore, the electronic device further comprises:
[0177] The communication interface 803 is used for communication between the memory 801 and the processor 802 .
[0178] The memory 801 is used to store computer programs that can be executed on the processor 802 .
[0179] The memory 801 may include a high-speed RAM (Random Access Memory) memory, and may also include a non-volatile memory, such as at least one disk memory.
[0180] If the memory 801, the processor 802 and the communication interface 803 are implemented independently, the communication interface 803, the memory 801 and the processor 802 can be connected to each other through a bus and communicate with each other. The bus can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0181] Optionally, in a specific implementation, if the memory 801, the processor 802 and the communication interface 803 are integrated on a chip, the memory 801, the processor 802 and the communication interface 803 can communicate with each other through an internal interface.
[0182] The processor 802 may be a CPU (Central Processing Unit), or an ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present application.
[0183] An embodiment of the present application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-mentioned monocular polarization three-dimensional reconstruction method based on deep learning.
[0184] An embodiment of the present invention also provides a computer program product, including a computer program, which, when executed by a processor, implements the above-mentioned monocular polarization three-dimensional reconstruction method based on deep learning.
[0185] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0186] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms are not necessarily directed to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
[0187] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations on the present application. Ordinary technicians in this field can change, modify, replace and modify the above embodiments within the scope of the present application.
Claims
1. A monocular polarization 3D reconstruction method based on deep learning, It is characterized in that The following steps are involved: Acquiring a plurality of polarization normal images of the object to be reconstructed; Calculate the polarization information encoding representation corresponding to each polarization normal image, and input the polarization information encoding representation corresponding to each polarization normal image into a preset deep learning model, and use the preset double-layer routing sparse self-attention mechanism to obtain the polarization normal image prediction result; The polarization normal image prediction result is three-dimensionally reconstructed using a preset discontinuity-preserving normal gradient integration strategy to obtain a three-dimensional reconstruction result of the object to be reconstructed.
2. The method according to claim 1, It is characterized in that The polarization information encoding is expressed as: Among them, cat is the splicing operation, S 0 is the intensity of light, S 1 is the intensity difference between the polarization components parallel to the reference plane and perpendicular to the reference plane in the electromagnetic wave, S 2 is the intensity difference of the polarization components with angles of 45° and -45° relative to the reference plane, ρ is the degree of linear polarization, is the linear polarization angle, v d is the viewing direction of the pixel.
3. The method according to claim 1, It is characterized in that The preset sparse self-attention mechanism of the two-layer routing is: O=Attention(Q,K g ,g)+LCE(V); Among them, O is the attention output, Q is the query, and K g 、V g For the constructed input key-value pairs, LCE is a depth convolution.
4. The method according to claim 1, It is characterized in that Before inputting the polarization information encoding representation into the preset deep learning model, the method further includes: Acquire a polarization reconstruction dataset consisting of historical polarization normal images, preprocess the polarization reconstruction dataset, and divide the preprocessed polarization reconstruction dataset into a training set and a validation set; The preset neural network is trained using the training set to obtain an initial deep learning model, and the initial deep learning model is verified using the verification set until the initial deep learning model meets the preset training criteria, and the iterative training of the preset neural network is terminated to obtain the preset deep learning model, otherwise the iterative training is continued after adjusting the training set of the preset neural network.
5. The method according to claim 4, It is characterized in that The using the training set to train a preset neural network to obtain an initial deep learning model, and using the verification set to verify the initial deep learning model until the initial deep learning model meets a preset training standard, includes: Based on a preset initial learning rate, using the training set to train the preset neural network to obtain the initial deep learning model; Obtaining a preset loss function according to a difference between the polarization normal image prediction result and the actual result of the polarization normal image in the verification set; Determining whether the initial deep learning model meets the preset training standard according to the preset loss function; If the initial deep learning model does not meet the preset training criteria, the preset initial learning rate is adjusted based on the cosine annealing strategy, and the steps of re-executing the preset initial learning rate and using the training set to train the preset neural network to obtain the initial deep learning model are performed until the initial deep learning model meets the preset training criteria.
6. A monocular polarization 3D reconstruction device based on deep learning, It is characterized in that include: An acquisition module, used for acquiring a plurality of polarization normal images of the object to be reconstructed; A processing module, used to calculate the polarization information encoding representation corresponding to each polarization normal image, and input the polarization information encoding representation corresponding to each polarization normal image into a preset deep learning model, and use the preset double-layer routing sparse self-attention mechanism to obtain the polarization normal image prediction result; The reconstruction module is used to perform three-dimensional reconstruction on the polarization normal image prediction result by using a preset discontinuity-preserving normal gradient integration strategy to obtain a three-dimensional reconstruction result of the object to be reconstructed.
7. The device according to claim 6, It is characterized in that The polarization information encoding is expressed as: Among them, cat is the splicing operation, S 0 is the intensity of light, S 1 is the intensity difference between the polarization components parallel to the reference plane and perpendicular to the reference plane in the electromagnetic wave, S 2 is the intensity difference of the polarization components with angles of 45° and -45° relative to the reference plane, ρ is the degree of linear polarization, is the linear polarization angle, v d is the viewing direction of the pixel.
8. An electronic device, It is characterized in that include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the monocular polarization 3D reconstruction method based on deep learning as described in any one of claims 1 to 5.
9. A computer-readable storage medium having a computer program stored thereon, It is characterized in that The program is executed by a processor to implement the monocular polarization three-dimensional reconstruction method based on deep learning as described in any one of claims 1 to 5.
10. A computer program product, It is characterized in that It includes a computer program, which, when executed by a processor, is used to implement the monocular polarization 3D reconstruction method based on deep learning as described in any one of claims 1 to 5.
Citation Information
Cited By
Method and device for detecting apparent defects of polaroid
CN119198565A
High-fidelity radiation field reconstruction method and system based on polarization normal estimation
CN119379954A
A high-fidelity radiation field reconstruction method and system based on polarization normal estimation
CN119379954B
Polarization imaging system, biological sample detection method, electronic equipment and storage medium
CN119595552A
Three-dimensional reconstruction method and device for double-layer transparent object
CN119762663A
