Three-dimensional reconstruction method of wheat colonies based on improved neural radiation field algorithm
By introducing deep supervision and attention mechanisms into the neural radiation field algorithm, combined with the improved MegaDepth algorithm, the problem of 3D modeling in dense wheat scenes is solved and high-quality 3D reconstruction effects are achieved.
Patent Information
- Application Number
- CN202411117538.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-15
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2044-08-15
Smart Images

Figure CN118628674B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of computer vision technology, and in particular to a three-dimensional reconstruction method for group wheat based on an improved neural radiation field algorithm. Background Art
[0002] 3D reconstruction technology has important practical significance in the fields of smart agriculture, smart cities, and autonomous driving. Most of these 3D reconstruction methods are based on depth information or 2D image generation, where depth information is mainly obtained by various radar sensors. The operation is cumbersome and the equipment cost is high, making it difficult to obtain widely.
[0003] The most classic traditional 3D reconstruction based on 2D images is MVS, which estimates the camera motion posture from the 2D image and then generates sparse point clouds and dense point clouds to achieve the purpose of 3D reconstruction, but the MVS method process is relatively cumbersome. In recent years, the popular Neural Implicit Radiance Field (NeRF) method uses deep learning to achieve integrated generation and has received widespread attention due to its excellent results. However, it has shortcomings for dense outdoor scenes, such as dense wheat data, where the intervals between wheat are short and the mutual coverage is serious, making it difficult to model it more completely. However, the 3D model of group wheat can most intuitively evaluate its growth, which is of great significance for its structured detection and analysis. Summary of the invention
[0004] In order to achieve high-quality and complete modeling of outdoor dense group wheat, the present invention provides a three-dimensional reconstruction method for group wheat based on a neural radiation field algorithm improved by deep supervision. NeRF uses the predicted scene depth information to supervise the generation of the scene, thereby meeting the needs of outdoor dense wheat field models.
[0005] In order to achieve the above-mentioned invention object, the present invention provides a three-dimensional reconstruction method for a group of wheat based on a neural radiation field algorithm improved by deep supervision, and the reconstruction method comprises the following steps:
[0006] Step S1: Obtaining a dense group wheat image dataset;
[0007] Step S2: input the source image in the image dataset into the pre-trained outdoor depth generation network to generate the corresponding depth image;
[0008] Step S3: construct a scene neural radiation field, generate rays in the neural radiation field, and obtain the position and direction of the sampling point on the ray;
[0009] Step S4: Obtain the depth value and depth weighted confidence corresponding to each ray;
[0010] Step S5: Encode the position and direction of the sampling point and input it into the scene neural radiance field network to obtain the RGB color value and density value of the sampling point, and predict the color value of the source image pixel through the rendering formula;
[0011] Step S6: Fitting the scene neural radiance field network using color rendering loss and depth loss;
[0012] Step S7: Generate an implicit expression of the group wheat scene, and use the occupancy field method to make it explicit, and finally obtain a curved three-dimensional model.
[0013] The step S1 specifically includes: recording a 360° video around the densely populated wheat field, extracting RGB source images frame by frame from the video, deleting images with poor quality, and recording each remaining RGB source image as , forming a training data set, where N represents the number of source images finally retained (where the video is recorded using an ordinary digital camera or mobile phone).
[0014] The step S2 is to input the source image into the pre-trained outdoor depth generation network to generate a depth image corresponding to the source image, wherein the outdoor depth generation network adopts an improved MegaDepth algorithm, which is mainly based on the Hourglass structure. The training process is specifically as follows:
[0015] First, the concept of logarithmic depth map is used to fit the generative deep network using a scale-invariant loss function, including data term, gradient matching term and ordinal depth loss term; the logarithmic depth map is defined as , where d refers to the depth value in the depth map, is a small constant used to avoid logarithmic operations on zero depth values;
[0016] For scale-invariant data items, the mean square error of the difference between the predicted logarithmic depth map and the actual logarithmic depth map is calculated using the following formula:
[0017] ;
[0018] in, ; and Respectively represent the predicted depth map and the real depth map by pixel position The corresponding single logarithmic depth value of the index, Refers to the corresponding pixels of the predicted depth map and the real depth map The depth value of is a constant with a small value; n represents the number of valid depth values in the actual logarithmic depth map;
[0019] By comparing the gradient differences between the predicted logarithmic depth map and the actual logarithmic depth map at different scales, the multi-scale scale-invariant gradient matching term is defined as:
[0020] ;
[0021] in, represents the value of the logarithmic depth difference map at position i and scale j, and Represent the gradients along the horizontal and vertical directions respectively;
[0022] The automatically generated ordinal depth relationship is used to train the network and encourage the network to learn the correct depth order, where the ordinal depth loss term is defined as:
[0023] ;
[0024] in, represents the ordinal depth relationship between pixels m and n, Indicates the ordinal depth relationship of automatic annotation.
[0025] The outdoor deep generative network is an improved MegaDepth neural network model, which adopts the Hourglass structure with symmetric encoder and decoder paths as the network architecture; an attention mechanism SinAM is added to each encoder module of the Hourglass structure, a sine function is used as the activation function, and the attention mechanism is combined to weight the features; a unique weight is assigned to each pixel, and the calculation formula is:
[0026] ;
[0027] For each pixel i, we calculate the similarity between it and other pixels j , and take the weighted average to get the pixel weight ; Then by converting the RGB image Input into the improved MegaDepth neural network model to get the corresponding depth map .
[0028] Among them, in the step S3, for the selection of the sampling point position on the ray, a layered sampling strategy is adopted, first uniform sampling is performed, and then dense sampling is performed in the key area determined according to the prediction results, so as to obtain the position and direction of the sampling point.
[0029] Set the depth weighted confidence for each depth value used for supervision, and set the depth value of a pixel j to , taking it as the center point and taking eight pixels outward with depth values of , then the depth weight corresponding to pixel j is reset to Set to , mapped to the range of 0-1 through the sigmoid function, the larger the value, the higher the contribution of deep supervision.
[0030] The formula for encoding the position and direction of the sampling point in step S5 is:
[0031] ;
[0032] in, Indicates the position of the sampling point on a certain axis, L Indicates the number of encoding layers, which determines the dimension of the encoded vector; therefore, for a position The input, the encoded position has multiple dimensions to represent the original three-dimensional coordinate vector;
[0033] Among them, the position of the encoded sampling point is put into the NeRF network to predict the color and density of each sampling point. The prediction formula is:
[0034] .
[0035] The rendering formula in step S6 is:
[0036] ;
[0037] Where m and n are the near and far boundaries of the ray, respectively. is the density value of the ray at a certain point, is the cumulative transparency from the proximal end to t, , is the color on the ray.
[0038] Specifically, in step S6, when training the neural radiation field model, a loss function is defined to guide model learning and measure the generated image. With real image The difference between them is calculated as:
[0039] ;
[0040] By minimizing the rendering loss, the model can learn to produce rendering results that are closer to the real image, thereby improving the quality of scene reconstruction;
[0041] The depth loss is set to be based on the mean square error ,in It is obtained by replacing the distance of a point with the color of the point according to the color rendering formula of the neural radiation field, which is the predicted depth value of the neural radiation field network; and To improve the Megadepth network prediction depth map The corresponding depth value and depth weight in the reset confidence, setting the weight to control the degree of supervision of each depth point, ,in is the control factor.
[0042] Wherein, in step S7, the implicit three-dimensional expression generated by NeRF is visualized by using the occupation field method, specifically:
[0043] (1) Generate occupation field:
[0044] Extract the probability of whether each point in the scene is occupied by an object from the NeRF model, which is the density value; discretize the density value into a three-dimensional grid, where each grid cell represents a voxel, and map the density value predicted by NeRF to the corresponding grid cell;
[0045] (2) Thresholding processing:
[0046] Grid cells with density values greater than the threshold are considered occupied, and grid cells with density values less than the threshold are considered idle;
[0047] (3) Surface extraction:
[0048] The surface of the object is extracted from the thresholded occupancy field using a surface extraction algorithm, and the boundaries between occupied and unoccupied grid cells in the occupancy field are converted into triangular meshes to form a surface representation of the object.
[0049] The beneficial effects of the present invention are as follows: based on the accurate expression of scenes by NeRF, the present invention utilizes a deep generative network with an added attention mechanism to set an effective deep prior for the wheat scene, effectively guides the NeRF network to predict dense scenes, and then uses an explicit algorithm to effectively and high-quality model the dense group wheat scene. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 It is a flow chart of Embodiment 1 and Embodiment 2 of the present invention.
[0051] Figure 2 It is a schematic diagram of obtaining experimental data in Example 2 of the present invention.
[0052] Figure 3 It is a schematic diagram of an outdoor depth generation network in Embodiment 1 and Embodiment 2 of the present invention.
[0053] Figure 4 It is a schematic diagram of the SimAM attention mechanism network in Example 1 and Example 2 of the present invention.
[0054] Figure 5Schematic diagram of a method for setting the confidence of depth weights in Embodiment 1 and Embodiment 2 of the present invention.
[0055] Figure 6 It is a schematic diagram of the NeRF network structure in Example 1 and Example 2 of the present invention.
[0056] Figure 7 It is a schematic diagram of the result model in Example 2. DETAILED DESCRIPTION
[0057] In order to clearly illustrate the technical features of this solution, this solution is described below through a specific implementation method.
[0058] Example 1: See Figure 1 The embodiment of the present invention provides a method for three-dimensional reconstruction of a group of wheat based on a neural radiation field algorithm improved by deep supervision, comprising the following steps:
[0059] Step S1: Obtaining a dense group wheat image dataset;
[0060] Step S2: input the source image in the image dataset into the pre-trained outdoor depth generation network to generate the corresponding depth image;
[0061] Step S3: construct a scene neural radiation field, generate rays in the neural radiation field, and obtain the position and direction of the sampling point on the ray;
[0062] Step S4: Obtain the depth value and depth weighted confidence corresponding to each ray;
[0063] Step S5: Encode the position and direction of the sampling point and input it into the scene neural radiance field network to obtain the RGB color value and density value of the sampling point, and predict the color value of the source image pixel through the rendering formula;
[0064] Step S6: Fitting the scene neural radiance field network using color rendering loss and depth loss;
[0065] Step S7: Generate an implicit expression of the group wheat scene, and use the occupancy field method to make it explicit, and finally obtain a curved three-dimensional model.
[0066] Step S1 specifically includes: recording a 360° video around a densely populated wheat field, extracting RGB source images frame by frame from the video, deleting images of poor quality, and recording each remaining RGB source image as , forming a training data set, where N represents the number of source images finally retained (where the video is recorded using an ordinary digital camera or mobile phone).
[0067] Step S2 is to input the source image into the pre-trained outdoor depth generation network to generate a depth image corresponding to the source image, wherein the outdoor depth generation network adopts the improved MegaDepth algorithm, which is mainly based on the Hourglass structure. The training process is specifically as follows:
[0068] First, the concept of logarithmic depth map is used to fit the generative deep network using a scale-invariant loss function, including data term, gradient matching term and ordinal depth loss term; the logarithmic depth map is defined as , where d refers to the depth value in the depth map, is a small constant used to avoid logarithmic operations on zero depth values;
[0069] For scale-invariant data items, the mean square error of the difference between the predicted logarithmic depth map and the actual logarithmic depth map is calculated using the following formula:
[0070] ;
[0071] in, ; and Respectively represent the predicted depth map and the real depth map by pixel position The corresponding single logarithmic depth value of the index, Refers to the corresponding pixels of the predicted depth map and the real depth map The depth value of is a constant with a small value; n represents the number of valid depth values in the actual logarithmic depth map;
[0072] By comparing the gradient differences between the predicted logarithmic depth map and the actual logarithmic depth map at different scales, the multi-scale scale-invariant gradient matching term is defined as:
[0073] ;
[0074] in, represents the value of the logarithmic depth difference map at position i and scale j, and Represent the gradients along the horizontal and vertical directions respectively;
[0075] The automatically generated ordinal depth relationship is used to train the network and encourage the network to learn the correct depth order, where the ordinal depth loss term is defined as:
[0076] ;
[0077] in, represents the ordinal depth relationship between pixels m and n, Indicates the ordinal depth relationship of automatic annotation.
[0078] The outdoor deep generative network is an improved MegaDepth neural network model, which adopts the Hourglass structure with symmetric encoder and decoder paths as the network architecture. The attention mechanism SinAM is added to each encoder module of the Hourglass structure, and the sine function is used as the activation function. The attention mechanism is combined to weight the features. A unique weight is assigned to each pixel, and the calculation formula is:
[0079] ;
[0080] For each pixel i, we calculate the similarity between it and other pixels j , and take the weighted average to get the pixel weight ; Then by converting the RGB image Input into the improved MegaDepth neural network model to get the corresponding depth map .
[0081] Among them, in step S3, for the selection of the sampling point position on the ray, a layered sampling strategy is adopted, first uniform sampling is performed, and then dense sampling is performed in the key area determined according to the prediction results, so as to obtain the position and direction of the sampling point.
[0082] Set the depth weighted confidence for each depth value used for supervision, and set the depth map The depth value of a pixel j in , taking it as the center point and taking eight pixels outward with depth values of , then the depth weight corresponding to pixel j is reset to Set to , mapped to the range of 0-1 through the sigmoid function, the larger the value, the higher the contribution of deep supervision.
[0083] The formula for encoding the position and direction of the sampling point in step S5 is:
[0084] ;
[0085] in, Indicates the position of the sampling point on a certain axis, L Indicates the number of encoding layers, which determines the dimension of the encoded vector; therefore, for a position The input, the encoded position has multiple dimensions to represent the original three-dimensional coordinate vector;
[0086] Among them, the position of the encoded sampling point is put into the NeRF network to predict the color and density of each sampling point. The prediction formula is: .
[0087] The rendering formula in step S6 is: ;
[0088] Where m and n are the near and far boundaries of the ray, respectively. is the density value of the ray at a certain point, is the cumulative transparency from the proximal end to t, , is the color on the ray.
[0089] Step S6 Specifically, when training the NeRF model, a loss function is defined to guide model learning and measure the generated image With real image The difference between them is calculated as: ;
[0090] By minimizing the rendering loss, the model can learn to produce rendering results that are closer to the real image, thereby improving the quality of scene reconstruction;
[0091] The depth loss is set to be based on the mean square error ,in It is obtained by replacing the distance of a point with the color of the point according to the color rendering formula of the neural radiation field, which is the predicted depth value of the neural radiation field network; and To improve the Megadepth network prediction depth map The corresponding depth value and depth weight in the reset confidence, setting the weight to control the degree of supervision of each depth point, ,in is the control factor.
[0092] Among them, in step S7, the implicit three-dimensional expression generated by NeRF is displayed through the occupation field method, specifically:
[0093] (1) Generate occupation field:
[0094] Extract the probability of whether each point in the scene is occupied by an object from the NeRF model, which is the density value; discretize the density value into a three-dimensional grid, where each grid cell represents a voxel, and map the density value predicted by NeRF to the corresponding grid cell;
[0095] (2) Thresholding processing:
[0096] Grid cells with density values greater than the threshold are considered occupied, and grid cells with density values less than the threshold are considered idle;
[0097] (3) Surface extraction:
[0098] The surface of the object is extracted from the thresholded occupancy field using a surface extraction algorithm, and the boundaries between occupied and unoccupied grid cells in the occupancy field are converted into triangular meshes to form a surface representation of the object.
[0099] Example 2: Figure 1 As shown, the embodiment of the present invention provides a method for three-dimensional reconstruction of a group of wheat based on a neural radiation field algorithm improved by deep supervision, and the specific steps include:
[0100] S1: Make the experimental source image dataset: Figure 2 As shown in the figure, for the dense group wheat experimental field, a 360° video will be recorded around it, and the video will be taken out one by one, and the poor quality images will be deleted. Each RGB source image is recorded as , forming a training data set, where Indicates the final number of retained images.
[0101] S2: Input the source image into the pre-trained outdoor depth generation network (improved MegaDepth algorithm, added attention mechanism) to generate the depth image corresponding to the source image. The pre-trained model can save a lot of time for model training. The generation process includes:
[0102] (1) A scale-invariant loss function, including data term, gradient matching term and ordinal depth loss term, is used to fit the generative deep network.
[0103] For scale-invariant data items, calculate the mean squared error of the difference between the predicted logarithmic depth map and the actual logarithmic depth map;
[0104] ;
[0105] in , and Represented by pixel position The corresponding single logarithmic depth value of the index, n represents the number of valid depth values in the real depth map.
[0106] For multi-scale scale-invariant gradient matching, in order to predict the depth map with smooth gradient changes and clear depth discontinuities, a multi-scale scale-invariant gradient matching term is introduced, which is defined by comparing the gradient differences between the predicted depth map and the true depth map at different scales;
[0107] ;
[0108] in represents the value of the logarithmic depth difference map at position i and scale j, and Represent the gradients along the horizontal and vertical directions respectively.
[0109] For the ordinal depth loss term, the network is trained using the automatically generated ordinal depth relationship to encourage the network to learn the correct depth order;
[0110] ;
[0111] in represents the ordinal depth relationship between pixels m and n, Indicates the ordinal depth relationship of automatic annotation.
[0112] (2) The improved Megadepth network adopts the Hourglass structure with symmetrical encoder and decoder paths as the network architecture. Since the texture features of group wheat data are weak and the scene is relatively complex, the present invention adds an attention mechanism SinAM to each encoder module of the Hourglass structure, uses a sine function as the activation function, and combines the attention mechanism to weight the features, so that the network pays more attention to important information to improve the effect of complete reconstruction. In addition, in order to better extract the features of group wheat, the attention mechanism is added as Figure 4 As shown:
[0113] The SimAM attention mechanism has the characteristics of small number of parameters and 3D features. It can improve the prediction performance of the network without increasing the computational cost. Its main core idea is based on the local self-similarity of the image. In an image, adjacent pixels usually have strong similarities, while the similarity between distant pixels is weaker. According to the similarity between the input data, the importance is dynamically adjusted, and a unique weight is assigned to each pixel, thereby improving the accuracy of 3D reconstruction. The calculation formula is,
[0114] ;
[0115] For each pixel i, we calculate the similarity between it and other pixels j , and take the weighted average to get the pixel weight .
[0116] S3: Generate rays in the modeling scene and obtain the position and direction of the sampling point on the ray:
[0117] In NeRF, a ray starts from the camera optical center and extends through a pixel in the image to the scene, which is defined as , where o represents the light point of the camera, d represents the direction of the ray, and its direction vector is solved as:
[0118] ;
[0119] in, It refers to the operation of normalizing a vector to a unit vector. p and o are the position coordinates of the viewpoint and a certain point respectively. Indicates the length of a vector.
[0120] For each pixel p in the image, uniform sampling is first performed along the ray from the camera viewpoint to a certain point in the image. After the output of the first round of the NeRF network, dense sampling is performed on the area where the object is located according to the expected prediction results, and then the position and direction of the sampling point on the scene ray are obtained.
[0121] S4: Get the depth value corresponding to each ray and its depth weighted reset confidence such as Figure 5 As shown:
[0122] In order to prevent some pixels with large depth value errors from having a negative effect on the fitting of the NeRF network, a weighted confidence is set for each depth supervision point. The depth value of a pixel j is set to , taking it as the center point and taking eight pixels outward with depth values of , then the depth weight corresponding to pixel j is reset to Set to: , mapped to the range of 0-1 through the sigmoid function, the larger the value, the higher the contribution of deep supervision.
[0123] S5: Encode the position and direction of the sampling point, input the encoding result into the NeRF network, obtain the RGB color and density value of the sampling point, and predict the color and depth of the pixel through the rendering formula, such as Figure 6 As shown:
[0124] The NeRF network mainly consists of two parts: the color network and the density network. The network structure consists of multiple layers of fully connected layers, and the layers are connected together through nonlinear activation functions (ReLU). The network input is processed position encoding to strengthen the representation of coordinate information in the network and ensure that the network can fully utilize the spatial position information for accurate rendering. The encoding formula is:
[0125] ;
[0126] in, represents the position of the sampling point on a certain axis, L represents the number of encoding layers, and determines the dimension of the encoded vector. The input, the encoded position has multiple dimensions to represent the original three-dimensional coordinate vector.
[0127] And put the encoded position into the NeRF network to predict the color and density of each sampling point:
[0128] ;
[0129] During the processing, the network learns how to map from input coordinates to color and volume density through training, and gradually establishes the mapping relationship by continuously optimizing the network parameters through the loss function.
[0130] The rendering formula is: ;
[0131] Where m and n are the near and far boundaries of the ray, respectively. is the density value of the ray at a certain point, T (t) is the cumulative transparency from the proximal end to t , is the color on the ray.
[0132] S6: Figure 6 As shown in the figure, in addition to the basic color rendering method, depth supervision is added when training the NeRF network, and the color rendering loss and depth loss are used to fit the NeRF network together:
[0133] When training the NeRF model, a loss function is defined to guide model learning and measure the generated image With real image The difference between: ;
[0134] By minimizing the rendering loss, the model can learn to produce rendering results that are closer to the real image, thereby improving the quality of scene reconstruction;
[0135] The depth loss is based on the mean square error and is set as: ,in It is obtained by replacing the distance of the point with the color of the point according to the color rendering formula of NeRF, that is, the predicted depth value of the NeRF network. Since the depth value generated by the outdoor depth generation network is not completely accurate, the weight is set to control the degree of supervision of each depth point. ,in To control the factors, deep joint supervision under the guidance of color and weight makes the NeRF network better fit.
[0136] S7: Generate an implicit expression of the group wheat scene and make it explicit using the occupancy field method, and finally obtain a surface 3D model as shown in Figure 7 As shown, the explicit process is as follows:
[0137] (1) Generate occupation field:
[0138] Extract the probability of whether each point in the scene is occupied by an object from the NeRF model, which is the density value; discretize the density value into a three-dimensional grid, where each grid cell represents a voxel, and map the density value predicted by NeRF to the corresponding grid cell;
[0139] (2) Thresholding processing:
[0140] Grid cells with density values greater than a certain threshold are considered occupied, and grid cells with density values less than the threshold are considered idle;
[0141] (3) Surface extraction:
[0142] The surface of the object is extracted from the thresholded occupancy field using a surface extraction algorithm, and the boundaries between occupied and unoccupied grid cells in the occupancy field are converted into triangular meshes to form a surface representation of the object.
[0143] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A three-dimensional reconstruction method for wheat population based on an improved neural radiation field algorithm, characterized in that: The reconstruction method comprises the following steps: Step S1: Obtaining a dense group wheat image dataset; Step S2: input the source image in the image dataset into the pre-trained outdoor depth generation network to generate the corresponding depth image; The outdoor depth generation network adopts the improved MegaDepth algorithm, which is mainly based on the Hourglass structure. The training process is as follows: First, the concept of logarithmic depth map is used to fit the generative deep network using a scale-invariant loss function, including data term, gradient matching term and ordinal depth loss term; the logarithmic depth map is defined as , where d refers to the depth value in the depth map, is a small constant used to avoid logarithmic operations on zero depth values; For scale-invariant data items, the mean square error of the difference between the predicted logarithmic depth map and the actual logarithmic depth map is calculated using the following formula: in, ; and Respectively represent the predicted depth map and the real depth map by pixel position The corresponding single logarithmic depth value of the index, Refers to the corresponding pixels of the predicted depth map and the real depth map The depth value of is a constant with a small value; n represents the number of valid depth values in the actual logarithmic depth map; By comparing the gradient differences between the predicted logarithmic depth map and the actual logarithmic depth map at different scales, the multi-scale scale-invariant gradient matching term is defined as: in, represents the value of the logarithmic depth difference map at position i and scale j, and Represent the gradients along the horizontal and vertical directions respectively; The automatically generated ordinal depth relationship is used to train the network and encourage the network to learn the correct depth order, where the ordinal depth loss term is defined as: in, represents the ordinal depth relationship between pixels m and n, Indicates the ordinal depth relationship of automatic annotation; The improved MegaDepth algorithm adopts the Hourglass structure with symmetric encoder and decoder paths as the network architecture; the attention mechanism SinAM is added to each encoder module of the Hourglass structure, the sine function is used as the activation function, and the attention mechanism is combined to weight the features; a unique weight is assigned to each pixel , the calculation formula is: For each pixel i, we calculate the similarity between it and other pixels j , and take the weighted average to get the pixel weight ; Then by converting the RGB image The corresponding depth map input to the improved MegaDepth algorithm ; Step S3: construct a scene neural radiation field, generate rays in the neural radiation field, and obtain the position and direction of the sampling point on the ray; Step S4: Obtain the depth value and depth weighted confidence corresponding to each ray; Step S5: Encode the position and direction of the sampling point and input it into the scene neural radiance field network to obtain the RGB color value and density value of the sampling point, and predict the color value of the source image pixel through the rendering formula; Step S6: Fitting the scene neural radiance field network using color rendering loss and depth loss; Step S7: Generate an implicit expression of the group wheat scene, and use the occupancy field method to make it explicit, and finally obtain a curved three-dimensional model.
2. The three-dimensional reconstruction method according to claim 1, characterized in that: The step S1 specifically includes: recording a 360° video around the densely populated wheat field, extracting RGB source images frame by frame from the video, deleting images of poor quality, and recording each remaining RGB source image as , forming a training data set, where N represents the number of source images finally retained.
3. The three-dimensional reconstruction method according to claim 1, characterized in that: In step S3, a layered sampling strategy is used to select the sampling point positions on the ray, firstly uniform sampling is performed, and then dense sampling is performed in the key area determined according to the prediction results, so as to obtain the positions and directions of the sampling points.
4. The three-dimensional reconstruction method according to claim 1, characterized in that: Set the depth weighted confidence for each depth value used for supervision, and set the depth map The depth value of a pixel j in , taking it as the center point and taking eight pixels outward with depth values of , then the depth weight corresponding to pixel j is reset to Set to , mapped to the range of 0-1 through the sigmoid function, the larger the value, the higher the contribution of deep supervision.
5. The three-dimensional reconstruction method according to claim 1, characterized in that: The formula for encoding the position and direction of the sampling point in step S5 is: in, Indicates the position of the sampling point on a certain axis, L Indicates the number of encoding layers, which determines the dimension of the encoded vector; therefore, for a position The input, the encoded position has multiple dimensions to represent the original three-dimensional coordinate vector; Among them, the position of the encoded sampling point is put into the neural radiation field network to predict the color and density of each sampling point. The prediction formula is: 。 6. The three-dimensional reconstruction method according to claim 1, characterized in that: The rendering formula in step S6 is: Where m and n are the near and far boundaries of the ray, respectively. is the density value of the ray at a certain point, is the cumulative transparency from the proximal end to t, , is the color on the ray.
7. The three-dimensional reconstruction method according to claim 1, characterized in that: Specifically, in step S6, when training the neural radiation field model, a loss function is defined to guide model learning and measure the generated image. With real image The difference between them is calculated as: By minimizing the rendering loss, the model learns to produce rendering results that are closer to the real image, thereby improving the quality of scene reconstruction; The depth loss is set to be based on the mean square error ,in It is obtained by replacing the distance of a point with the color of the point according to the color rendering formula of the neural radiation field, which is the predicted depth value of the neural radiation field network; and To improve the Megadepth network prediction depth map The corresponding depth value and depth weight in the reset confidence, setting the weight to control the degree of supervision of each depth point, ,in is the control factor.
8. The three-dimensional reconstruction method according to claim 1, characterized in that: In step S7, the implicit three-dimensional expression generated by the neural radiation field is visualized by using the occupancy field method, specifically: (1) Generate occupation field: Extract the probability of whether each point in the scene is occupied by an object, i.e., the density value, from the neural radiation field model; discretize the density value into a three-dimensional grid, where each grid unit represents a voxel, and map the density value predicted by the neural radiation field to the corresponding grid unit; (2) Thresholding processing: Grid cells with density values greater than the threshold are considered occupied, and grid cells with density values less than the threshold are considered idle; (3) Surface extraction: The surface of the object is extracted from the thresholded occupancy field using a surface extraction algorithm, and the boundaries between occupied and unoccupied grid cells in the occupancy field are converted into triangular meshes to form a surface representation of the object.
Citation Information
Cited By
Three-dimensional scene reconstruction method based on multi-camera neural radiation field
CN119359921A
